Skip to content

Commit

Permalink
added toggle visual layer button
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksander Morgensterns committed Jun 13, 2024
1 parent 4ca472b commit 6499730
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 10 deletions.
21 changes: 16 additions & 5 deletions source/GM-TE/GMTEEditor.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ GMTEEditor >> createTilestoreSpecWithBuilder: aBuilder [

{
#category : #building,
#'squeak_changestamp' : 'TW 6/9/2024 18:12'
#'squeak_changestamp' : 'Alex M 6/13/2024 15:00'
}
GMTEEditor >> createToolBarSpecWithBuilder: aBuilder [
^aBuilder pluggablePanelSpec new
Expand All @@ -425,9 +425,10 @@ GMTEEditor >> createToolBarSpecWithBuilder: aBuilder [
action:#resetAll;
frame: (LayoutFrame fractions: (0 @ 0 corner: 0.25 @ 1) offsets: nil).
aBuilder pluggableButtonSpec new
name: 'button2';
label: 'Button 2';
name: 'toggleVisual';
label: 'Toggle Grid';
model: self;
action: #toggleGrid;
frame: (LayoutFrame fractions: (0.25 @ 0 corner: 0.5 @ 1) offsets: nil).
aBuilder pluggableButtonSpec new
name: 'button3';
Expand Down Expand Up @@ -1055,10 +1056,12 @@ GMTEEditor >> setGridHeight: aText [

{
#category : #'inspector handling',
#'squeak_changestamp' : 'TW 6/11/2024 18:11'
#'squeak_changestamp' : 'Alex M 6/13/2024 17:27'
}
GMTEEditor >> setGridWidth: aText [


"TODO: Fix visual layer bug"

| newSize |

newSize := self parseGridSize: aText.
Expand Down Expand Up @@ -1137,6 +1140,14 @@ GMTEEditor >> tileViewer: anObject [
tileViewer := anObject.
]

{
#category : #'button functions',
#'squeak_changestamp' : 'Alex M 6/13/2024 15:00'
}
GMTEEditor >> toggleGrid [
self tileMapMatrix toggleVisualLayer
]

{
#category : #accessing,
#'squeak_changestamp' : 'TW 5/22/2024 00:59'
Expand Down
41 changes: 36 additions & 5 deletions source/GM-TE/GMTETileMap.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ Class {
'tileCornerOffset',
'mapPaddedHeight',
'tileMatrixStack',
'tileMatrixStackVisual'
'tileMatrixStackVisual',
'visualLayerEnabled'
],
#category : #'GM-TE-Core'
}
Expand Down Expand Up @@ -122,21 +123,24 @@ GMTETileMap >> correctedTilePosition: aPoint [

{
#category : #updating,
#'squeak_changestamp' : 'Ivo Zilkenat 6/7/2024 21:53'
#'squeak_changestamp' : 'Alex M 6/13/2024 14:57'
}
GMTETileMap >> disableVisualLayer [

self tileMatrixStackVisual doTiles: [ :aTile | aTile removeBorderHighlighting]
self tileMatrixStackVisual doTiles: [ :aTile | aTile removeBorderHighlighting].
self visualLayerEnabled: false.

]

{
#category : #updating,
#'squeak_changestamp' : 'Ivo Zilkenat 6/7/2024 21:52'
#'squeak_changestamp' : 'Alex M 6/13/2024 15:15'
}
GMTETileMap >> enableVisualLayer [

self tileMatrixStackVisual doTiles: [ :aTile | aTile applyBorderHighlighting]
self tileMatrixStackVisual doTiles: [ :aTile | aTile applyBorderHighlighting].
"self rescaleMap."
self visualLayerEnabled: true
]

{
Expand Down Expand Up @@ -705,6 +709,17 @@ GMTETileMap >> tileWidth: anObject [
tileWidth := anObject.
]

{
#category : #updating,
#'squeak_changestamp' : 'Alex M 6/13/2024 14:58'
}
GMTETileMap >> toggleVisualLayer [

visualLayerEnabled
ifTrue: [self disableVisualLayer]
ifFalse: [self enableVisualLayer]
]

{
#category : #updating,
#'squeak_changestamp' : 'Ivo Zilkenat 5/19/2024 17:52'
Expand Down Expand Up @@ -801,3 +816,19 @@ GMTETileMap >> updateTiles [
self updateTileMatrixStack: self tileMatrixStack.
self updateTileMatrixStack: self tileMatrixStackVisual
]

{
#category : #accessing,
#'squeak_changestamp' : 'Alex M 6/13/2024 14:56'
}
GMTETileMap >> visualLayerEnabled [
^ visualLayerEnabled
]

{
#category : #accessing,
#'squeak_changestamp' : 'Alex M 6/13/2024 14:56'
}
GMTETileMap >> visualLayerEnabled: anObject [
visualLayerEnabled := anObject
]

0 comments on commit 6499730

Please sign in to comment.