Skip to content

Commit 62c4395

Browse files
committed
Implemented bubbling
1 parent 07307c9 commit 62c4395

File tree

2 files changed

+37
-49
lines changed

2 files changed

+37
-49
lines changed

source/GM-TE/GMTEEditor.class.st

Lines changed: 34 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ GMTEEditor >> brushButtons: anObject [
373373

374374
{
375375
#category : #building,
376-
#'squeak_changestamp' : 'mcjj 7/10/2024 16:51'
376+
#'squeak_changestamp' : 'mcjj 7/11/2024 15:51'
377377
}
378378
GMTEEditor >> buildWith: builder [
379379
"builds the editor with ToolBuilder"
@@ -394,6 +394,8 @@ GMTEEditor >> buildWith: builder [
394394
closeAction: #onClose;
395395
minimumExtent: GMTEEditor editorMinimumExtent).
396396

397+
newMorph addKeyboardCaptureFilter: self.
398+
397399
self commandBar: (newMorph submorphNamed: 'command bar').
398400
"self commandBar vResizing: #rigid."
399401
self tileStore: (newMorph submorphNamed: 'tile store').
@@ -422,8 +424,7 @@ GMTEEditor >> buildWith: builder [
422424

423425
self
424426
initializeDefaultTileMapMatrix;
425-
associatedMorph: newMorph;
426-
setupInputHandlingFor: newMorph.
427+
associatedMorph: newMorph.
427428

428429
^ newMorph
429430
]
@@ -968,15 +969,6 @@ GMTEEditor >> disableSingleLayerButtons [
968969
GMTEEditor singleLayerActionNames do: [:aString | (self associatedMorph submorphNamed: aString) enabled: false ]
969970
]
970971

971-
{
972-
#category : #'input handling',
973-
#'squeak_changestamp' : 'mcjj 7/10/2024 16:47'
974-
}
975-
GMTEEditor >> dropKeyboardFocus: anEvent [
976-
977-
anEvent hand releaseKeyboardFocus: self associatedMorph
978-
]
979-
980972
{
981973
#category : #'as yet unclassified',
982974
#'squeak_changestamp' : 'TW 6/25/2024 17:51'
@@ -1032,6 +1024,36 @@ GMTEEditor >> exportMenu [
10321024
builder open: aMenuSpec
10331025
]
10341026

1027+
{
1028+
#category : #'input handling',
1029+
#'squeak_changestamp' : 'mcjj 7/11/2024 15:57'
1030+
}
1031+
GMTEEditor >> filterEvent: aKeyboardEvent for: anObject [
1032+
| key |
1033+
1034+
aKeyboardEvent isKeystroke
1035+
ifFalse: [^ aKeyboardEvent].
1036+
1037+
key := aKeyboardEvent key.
1038+
1039+
aKeyboardEvent commandKeyPressed ifTrue: [
1040+
aKeyboardEvent shiftPressed
1041+
ifTrue: [
1042+
key caseOf: {
1043+
[$Z] -> [self redo].
1044+
} otherwise: [^ aKeyboardEvent "no hit"].
1045+
^ aKeyboardEvent ignore "hit"]
1046+
ifFalse: [
1047+
key caseOf: {
1048+
[$Z] -> [self undo].
1049+
[$Y] -> [self redo].
1050+
[$R] -> [self rotateSelectedTile].
1051+
} otherwise: [^ aKeyboardEvent "no hit"].
1052+
^ aKeyboardEvent ignore "hit"]].
1053+
1054+
^ aKeyboardEvent "no hit"
1055+
]
1056+
10351057
{
10361058
#category : #accessing,
10371059
#'squeak_changestamp' : 'TW 7/9/2024 17:14'
@@ -1106,15 +1128,6 @@ GMTEEditor >> getGridWidthAsString [
11061128
^ self getGridWidth asString
11071129
]
11081130

1109-
{
1110-
#category : #'input handling',
1111-
#'squeak_changestamp' : 'mcjj 7/10/2024 16:46'
1112-
}
1113-
GMTEEditor >> getKeyboardFocus: anEvent [
1114-
1115-
anEvent hand newKeyboardFocus: self associatedMorph
1116-
]
1117-
11181131
{
11191132
#category : #'layer manipulation',
11201133
#'squeak_changestamp' : 'TW 6/23/2024 21:50'
@@ -1182,18 +1195,6 @@ GMTEEditor >> getTileRatioAsString [
11821195
^ self getTileRatio asString
11831196
]
11841197

1185-
{
1186-
#category : #'input handling',
1187-
#'squeak_changestamp' : 'mcjj 7/10/2024 16:49'
1188-
}
1189-
GMTEEditor >> handleKeyStroke: anEvent [
1190-
1191-
| keyValue |
1192-
keyValue := anEvent key.
1193-
Transcript show: keyValue
1194-
"keyValue = $A"
1195-
]
1196-
11971198
{
11981199
#category : #'menu button functions',
11991200
#'squeak_changestamp' : 'TW 6/23/2024 20:09'
@@ -2016,20 +2017,6 @@ GMTEEditor >> settingsMenu [
20162017
builder open: aMenuSpec
20172018
]
20182019

2019-
{
2020-
#category : #'input handling',
2021-
#'squeak_changestamp' : 'mcjj 7/10/2024 16:49'
2022-
}
2023-
GMTEEditor >> setupInputHandlingFor: aMorph [
2024-
2025-
aMorph
2026-
on: #mouseMove send: #getKeyboardFocus: to: self;
2027-
on: #mouseLeave send: #dropKeyboardFocus: to: self;
2028-
on: #keyStroke send: #handleKeyStroke: to: self.
2029-
2030-
aMorph eventHandler wantsEveryMouseMove: true
2031-
]
2032-
20332020
{
20342021
#category : #'layer manipulation',
20352022
#'squeak_changestamp' : 'jj 6/22/2024 21:43'

source/GM-TE/GMTEEditorTileMap.class.st

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ GMTEEditorTileMap >> mouseMove: anEvent [
172172

173173
{
174174
#category : #'event handling',
175-
#'squeak_changestamp' : 'Valentin Teutschbein 7/10/2024 13:11'
175+
#'squeak_changestamp' : 'mcjj 7/11/2024 11:14'
176176
}
177177
GMTEEditorTileMap >> mouseUp: anEvent [
178178

@@ -183,7 +183,8 @@ GMTEEditorTileMap >> mouseUp: anEvent [
183183
self updateTiles: (indicesToAdd asCollection) inLayer: activeLayer FromEvent: anEvent.
184184
self model brush resetOutputSet.
185185
(self previousTileStates size > 0) ifTrue: [self saveTileEditChanges].
186-
self tileSelectionSet highlightImage: (self model selectedTile).
186+
self tileSelectionSet clearAllHighlightings.
187+
self tileSelectionSet highlightImage: (self model selectedTile)
187188
]
188189

189190
{

0 commit comments

Comments
 (0)