Skip to content

Commit 72b58f7

Browse files
committed
fixed tile deletion highlighting
1 parent 515aee4 commit 72b58f7

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

source/GM-TE/GMTEBrush.class.st

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ GMTEBrush >> radius: anObject [
234234

235235
{
236236
#category : #forms,
237-
#'squeak_changestamp' : 'Valentin Teutschbein 7/9/2024 22:11'
237+
#'squeak_changestamp' : 'Valentin Teutschbein 7/10/2024 12:37'
238238
}
239239
GMTEBrush >> radiusBrush [
240240

@@ -250,7 +250,7 @@ GMTEBrush >> radiusBrush [
250250

251251
(xMin to: xMax) do: [:x |
252252
(yMin to: yMax) do: [:y |
253-
(( self currentMatrixIndex x - x) squared + ( self currentMatrixIndex y - y) squared <= self radius squared) ifTrue: [
253+
(( self currentMatrixIndex x - x) squared + ( self currentMatrixIndex y - y) squared <= (self radius - 1) squared) ifTrue: [
254254
collection add: x@y
255255
].
256256
].

source/GM-TE/GMTEEditorTileMap.class.st

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ GMTEEditorTileMap >> model: anObject [
113113

114114
{
115115
#category : #'event handling',
116-
#'squeak_changestamp' : 'Valentin Teutschbein 7/9/2024 21:46'
116+
#'squeak_changestamp' : 'Valentin Teutschbein 7/10/2024 13:07'
117117
}
118118
GMTEEditorTileMap >> mouseDown: anEvent [
119119
"Implements placement of tiles"
@@ -125,14 +125,14 @@ GMTEEditorTileMap >> mouseDown: anEvent [
125125
selectedIndex := self tileIndexFromPosition: anEvent position.
126126
self model brush firstMatrixIndex: selectedIndex.
127127
selectedCoordinates := self model brush executeWithMatrixIndex: selectedIndex andLayer: (self tileMatrixStack layer: activeLayer).
128-
"self updateTiles: selectedCoordinates inLayer: activeLayer FromEvent: anEvent."
128+
anEvent yellowButtonPressed ifTrue: [self tileSelectionSet highlightImage: nil].
129129

130130
^ true
131131
]
132132

133133
{
134134
#category : #'event handling',
135-
#'squeak_changestamp' : 'Valentin Teutschbein 7/9/2024 22:02'
135+
#'squeak_changestamp' : 'Valentin Teutschbein 7/10/2024 13:06'
136136
}
137137
GMTEEditorTileMap >> mouseMove: anEvent [
138138
"Implements highlighting of tiles when hovering"
@@ -145,17 +145,16 @@ GMTEEditorTileMap >> mouseMove: anEvent [
145145
(anEvent redButtonPressed or: [anEvent yellowButtonPressed]) ifFalse: [self model brush resetOutputSet].
146146
self tileSelectionSet clearAllHighlightings.
147147

148-
selectedCoordinates ifNil: [
149-
^ nil].
148+
selectedCoordinates ifNil: [^ nil].
150149

151-
(selectedCoordinates select: [:c | (self tileMatrixStack layer: activeLayer) inBounds: c]) do: [:c|
152-
hoveredTileHighlighting := self highlightingTileFromIndex: c.
150+
(selectedCoordinates select: [:c | (self tileMatrixStack layer: activeLayer) inBounds: c]) do: [:t|
151+
hoveredTileHighlighting := self highlightingTileFromIndex: t.
153152
hoveredTileHighlighting ifNotNil: [self tileSelectionSet highlightTile: hoveredTileHighlighting]].
154153
]
155154

156155
{
157156
#category : #'event handling',
158-
#'squeak_changestamp' : 'Valentin Teutschbein 7/9/2024 22:13'
157+
#'squeak_changestamp' : 'Valentin Teutschbein 7/10/2024 13:11'
159158
}
160159
GMTEEditorTileMap >> mouseUp: anEvent [
161160

@@ -165,7 +164,8 @@ GMTEEditorTileMap >> mouseUp: anEvent [
165164
activeLayer := self model selectedLayers anyOne.
166165
self updateTiles: (indicesToAdd asCollection) inLayer: activeLayer FromEvent: anEvent.
167166
self model brush resetOutputSet.
168-
(self previousTileStates size > 0) ifTrue: [self saveTileEditChanges]
167+
(self previousTileStates size > 0) ifTrue: [self saveTileEditChanges].
168+
self tileSelectionSet highlightImage: (self model selectedTile).
169169
]
170170

171171
{

0 commit comments

Comments
 (0)