Skip to content

Commit

Permalink
Further renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivo Zilkenat committed Jun 21, 2024
1 parent 10deb1d commit b15c101
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 41 deletions.
21 changes: 11 additions & 10 deletions source/GM-TE/GMTEEditorTileMap.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -87,25 +87,26 @@ GMTEEditorTileMap >> mouseDown: anEvent [

{
#category : #'event handling',
#'squeak_changestamp' : 'TW 6/20/2024 16:35'
#'squeak_changestamp' : 'Ivo Zilkenat 6/21/2024 22:00'
}
GMTEEditorTileMap >> mouseMove: anEvent [

| hoveredTile hoveredTileVisual activeLayer |

self model singleLayerSelected
ifTrue: [activeLayer := self model selectedLayers anyOne.

hoveredTile := self tileFromPosition: anEvent position layer: activeLayer.
hoveredTileVisual := self tileVisualFromPosition: anEvent position.
ifTrue: [
activeLayer := self model selectedLayers anyOne.

hoveredTile := self tileFromPosition: anEvent position layer: activeLayer.
hoveredTileVisual := self HighlightingTileFromPosition: anEvent position.

self tileSelectionSet clearAllHighlightings.
self tileSelectionSet clearAllHighlightings.

hoveredTileVisual
ifNotNil: [self tileSelectionSet highlightTile: hoveredTileVisual].
hoveredTileVisual
ifNotNil: [self tileSelectionSet highlightTile: hoveredTileVisual].

"TODO why another ifNil check here?"
self updateTile: hoveredTile inLayer: activeLayer FromEvent: anEvent]
"TODO why another ifNil check here?"
self updateTile: hoveredTile inLayer: activeLayer FromEvent: anEvent]

"This solves the bug but not the root of the issue. TODO further investigation."
"self updateTiles."
Expand Down
62 changes: 31 additions & 31 deletions source/GM-TE/GMTETileMap.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,20 @@ GMTETileMap class >> tileWidth: aWidth tileHeight: aHeight padding: aPadding siz
tileSizeRatio: aRatio
]

{
#category : #accessing,
#'squeak_changestamp' : 'Ivo Zilkenat 6/21/2024 22:00'
}
GMTETileMap >> HighlightingTileFromPosition: aPoint [

| idx |

idx := self tileIdxFromPosition: aPoint.
idx ifNil: [^nil].

^ self tileMatrixStackHighlighting layer: 1 at: idx y at: idx x.
]

{
#category : #accessing,
#'squeak_changestamp' : 'Ivo Zilkenat 6/19/2024 23:07'
Expand Down Expand Up @@ -350,15 +364,28 @@ GMTETileMap >> generateBackgroundTiles [

{
#category : #initialization,
#'squeak_changestamp' : 'Ivo Zilkenat 6/21/2024 21:49'
#'squeak_changestamp' : 'Ivo Zilkenat 6/21/2024 22:00'
}
GMTETileMap >> generateHighlightingTiles [

self tileMatrixStackHighlighting doTilesXYLidx: [ :x :y :l |
"It is assumed that the visual stack consists of only one layer"
self generateTileAtlayer: l x: x y: y stack: self tileMatrixStackHighlighting tileType: GMTETileHighlighting].


]

{
#category : #initialization,
#'squeak_changestamp' : 'Ivo Zilkenat 6/21/2024 22:00'
}
GMTETileMap >> generateMatrixStacks [

self tileMatrixStackBackground: (GMTETileMatrixStack fromWidth: self tileWidth height: self tileHeight morphicLayerOffset: 101).
self tileMatrixStack: (GMTETileMatrixStack fromWidth: self mapTileWidth height: self mapTileHeight morphicLayerOffset: 100).
self tileMatrixStackHighlighting: (GMTETileMatrixStack fromWidth: self mapTileWidth height: self mapTileHeight morphicLayerOffset: 10). "TODO: Number ?"
"self generateBackgroundTiles."
self generateVisualTiles.
self generateHighlightingTiles.
self toggleBackgroundLayer
]

Expand Down Expand Up @@ -401,19 +428,6 @@ GMTETileMap >> generateTileAtlayer: aLayer x: x y: y stack: aStack tileType: aTi



]

{
#category : #initialization,
#'squeak_changestamp' : 'Ivo Zilkenat 6/21/2024 21:49'
}
GMTETileMap >> generateVisualTiles [

self tileMatrixStackHighlighting doTilesXYLidx: [ :x :y :l |
"It is assumed that the visual stack consists of only one layer"
self generateTileAtlayer: l x: x y: y stack: self tileMatrixStackHighlighting tileType: GMTETileHighlighting].


]

{
Expand Down Expand Up @@ -680,7 +694,7 @@ GMTETileMap >> rescaleMapWidth: aWidth height: aHeigth padding: aPadding [

{
#category : #updating,
#'squeak_changestamp' : 'Ivo Zilkenat 6/21/2024 21:49'
#'squeak_changestamp' : 'Ivo Zilkenat 6/21/2024 22:00'
}
GMTETileMap >> rescaleMatrixStacks [

Expand All @@ -692,7 +706,7 @@ GMTETileMap >> rescaleMatrixStacks [
(self tileMatrixStackHighlighting) ifNotNil: [
self tileMatrixStackHighlighting rescaleToWidth: self mapTileWidth height: self mapTileHeight.
self tileMatrixStackHighlighting reset.
self generateVisualTiles]
self generateHighlightingTiles]
]

{
Expand Down Expand Up @@ -968,20 +982,6 @@ GMTETileMap >> tileSizeWidth: anObject [
tileSizeWidth := anObject.
]

{
#category : #accessing,
#'squeak_changestamp' : 'Ivo Zilkenat 6/21/2024 21:49'
}
GMTETileMap >> tileVisualFromPosition: aPoint [

| idx |

idx := self tileIdxFromPosition: aPoint.
idx ifNil: [^nil].

^ self tileMatrixStackHighlighting layer: 1 at: idx y at: idx x.
]

{
#category : #accessing,
#'squeak_changestamp' : 'Ivo Zilkenat 5/19/2024 15:57'
Expand Down

0 comments on commit b15c101

Please sign in to comment.