Skip to content

Commit

Permalink
BlMorphicEventHandler>>handleMouseWheel: changed to work in case of h…
Browse files Browse the repository at this point in the history
…orizontal scrolling
  • Loading branch information
plantec committed Nov 29, 2023
1 parent a3850d8 commit ee65a43
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src/BlocHost-Morphic/BlMorphicEventHandler.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -373,22 +373,24 @@ BlMorphicEventHandler >> handleMouseUp: anEvent [

{ #category : #'event handling' }
BlMorphicEventHandler >> handleMouseWheel: anEvent [
self convertMousePosition: anEvent andDo: [ :aMorphicEvent |
| aBlEvent vectorOffset vector |

vectorOffset := aMorphicEvent direction = Character arrowDown
ifTrue: [ -5 ]
ifFalse: [ 5 ].
vector := self horizontalScrolling
ifTrue: [ BlVector x: vectorOffset y: 0 ]
ifFalse: [ BlVector x: 0 y: vectorOffset ].
self convertMousePosition: anEvent andDo: [ :aMorphicEvent |
| aBlEvent vectorOffset vector |
vectorOffset := (aMorphicEvent direction = Character arrowDown or: [
aMorphicEvent direction = Character arrowLeft ])
ifTrue: [ -5 ]
ifFalse: [ 5 ].
vector := (aMorphicEvent direction = Character arrowLeft or: [
aMorphicEvent direction = Character arrowRight ])
ifTrue: [ BlVector x: vectorOffset y: 0 ]
ifFalse: [ BlVector x: 0 y: vectorOffset ]. " self horizontalScrolling "
aBlEvent := BlMouseWheelEvent new
vector: vector;
modifiers: (self convertKeyModifiersFromEvent: aMorphicEvent);
position: aMorphicEvent position;
screenPosition: (self globalMousePositionForEvent: aMorphicEvent);
timestamp: DateAndTime now.
vector: vector;
modifiers: (self convertKeyModifiersFromEvent: aMorphicEvent);
position: aMorphicEvent position;
screenPosition: (self globalMousePositionForEvent: aMorphicEvent);
timestamp: DateAndTime now.

self enqueue: aBlEvent ]
]

Expand Down

0 comments on commit ee65a43

Please sign in to comment.