Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BlEvent>>consume that is equivalent to consume: true #492

Merged
merged 1 commit into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Bloc-DevTool/BlSelectionTool.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ BlSelectionTool >> dragEvent: anEvent [

{ #category : #'dnd handlers' }
BlSelectionTool >> dragStartEvent: anEvent [
anEvent consumed: true.


anEvent consume.
self resetCurrentSelections.
startPosition := anEvent position.
selectionRect size:50@50; position:startPosition.
Expand Down
5 changes: 3 additions & 2 deletions src/Bloc-PullAndSlide/BlScrollSlideHandler.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ BlScrollSlideHandler >> initialize [

{ #category : #'mouse handlers' }
BlScrollSlideHandler >> mouseWheelEvent: anEvent [

| aTargetElement |
anEvent consumed: true.
anEvent consume.

aTargetElement := targetElement ifNil: anEvent currentTarget.
aTargetElement := targetElement ifNil: [ anEvent currentTarget ].

aTargetElement children accountedByLayout do: [ :aChild |
| aHorizontalScrollDelta aVerticalScrollDelta |
Expand Down
16 changes: 10 additions & 6 deletions src/Bloc-PullAndSlide/BlSlideHandler.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ Class {

{ #category : #'dnd handlers' }
BlSlideHandler >> dragEvent: anEvent [

| aStartPosition aCurrentPosition aDelta aTargetElement |
anEvent consumed: true.

aTargetElement := targetElement ifNil: anEvent currentTarget.
anEvent consume.
aTargetElement := targetElement ifNil: [ anEvent currentTarget ].

aStartPosition := aTargetElement globalPointToChildren: dragStartPosition.
aCurrentPosition := aTargetElement globalPointToChildren: anEvent position.
Expand All @@ -33,13 +33,17 @@ BlSlideHandler >> dragEvent: anEvent [

{ #category : #'dnd handlers' }
BlSlideHandler >> dragStartEvent: anEvent [
anEvent consumed: true.

anEvent consume.

"drag start position in space"
dragStartPosition := anEvent position.

(targetElement ifNil: anEvent currentTarget) children accountedByLayout
do: [ :aChild | aChild userData at: #slideHandlerStartPosition put: aChild constraints position ]
(targetElement ifNil: [ anEvent currentTarget ]) children accountedByLayout
do: [ :aChild |
aChild userData
at: #slideHandlerStartPosition
put: aChild constraints position ]
]

{ #category : #accessing }
Expand Down
7 changes: 7 additions & 0 deletions src/Bloc/BlEvent.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,15 @@ BlEvent >> capturingTarget: aTBlEventTarget [
currentTarget := aTBlEventTarget
]

{ #category : #testing }
BlEvent >> consume [

consumed := true
]

{ #category : #testing }
BlEvent >> consumed: aBoolean [

consumed := aBoolean
]

Expand Down
7 changes: 4 additions & 3 deletions src/Bloc/BlSelectionHandler.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ BlSelectionHandler >> computeSelectionArea [

{ #category : #'dnd handlers' }
BlSelectionHandler >> dragEndEvent: anEvent [
anEvent consumed: true.

anEvent consume.

origin := nil.
corner := nil.
Expand All @@ -41,7 +42,7 @@ BlSelectionHandler >> dragEvent: anEvent [
self hasOrigin
ifFalse: [ ^ self ].

anEvent consumed: true.
anEvent consume.

corner := anEvent position.
self computeSelectionArea.
Expand All @@ -51,8 +52,8 @@ BlSelectionHandler >> dragEvent: anEvent [

{ #category : #'dnd handlers' }
BlSelectionHandler >> dragStartEvent: anEvent [
anEvent consumed: true.

anEvent consume.
origin := anEvent position
]

Expand Down
2 changes: 1 addition & 1 deletion src/Bloc/BlShortcutHandlerWithShortcuts.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ BlShortcutHandlerWithShortcuts >> handleEvent: aShortcutEvent [
| aShortcut |
aShortcut := theShortcuts first key.
"let users explicitely set consumed to false so it bubbles up"
aShortcutEvent consumed: true.
aShortcutEvent consume.
aShortcut performDueTo: aShortcutEvent ]
]

Expand Down