Skip to content

Commit

Permalink
Implement zooming by using mouse wheel
Browse files Browse the repository at this point in the history
  • Loading branch information
kpostnov committed Jun 24, 2021
1 parent 90b2030 commit e935863
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
ctrlPressed: aBoolean
ctrlPressed := aBoolean
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
ctrlPressed
^ ctrlPressed ifNil: [ctrlPressed := false]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
event handling
handlesKeyboard: evt
^ true
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
event handling
handlesMouseWheel: evt
^ true

This comment has been minimized.

Copy link
@kpostnov

kpostnov Jun 24, 2021

Author Contributor

Consider adding a newline here and in handlesKeyboard in the next commit.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
event handling
keyDown: aKeyboardEvent
aKeyboardEvent keyValue = 17 ifTrue: [self ctrlPressed: true]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
event handling
keyUp: aKeyboardEvent
aKeyboardEvent keyValue = 17 ifTrue: [self ctrlPressed: false]
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
event handling
mouseWheel: evt
self ctrlPressed ifFalse: [
(self ownerThatIsA: PluggableScrollPane) mouseWheel: evt]
ifTrue: [evt isWheelDown
ifFalse: [self zoomIn]
ifTrue: [self zoomOut]]


Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,29 @@
"instance" : {
"addGripMorph:" : "JP 5/19/2021 00:31",
"backend" : "mFr 6/9/2021 16:42",
"ctrlPressed" : "K.P. 6/25/2021 00:06",
"ctrlPressed:" : "K.P. 6/25/2021 00:06",
"defaultCanvasSize" : "wr 5/23/2020 10:56",
"extent:" : "wr 6/22/2020 16:26",
"fastFramingOn" : "JP 5/19/2021 00:17",
"gripMorph" : "CS 5/16/2021 20:20",
"gripMorph:" : "CS 5/16/2021 20:21",
"handlesKeyboard:" : "K.P. 6/24/2021 23:16",
"handlesMouseDown:" : "mp 5/17/2020 11:53",
"handlesMouseMove:" : "mp 5/17/2020 11:52",
"handlesMouseOverDragging:" : "mp 5/17/2020 11:52",
"handlesMouseWheel:" : "K.P. 6/25/2021 00:12",
"initialize" : "mFr 6/24/2021 18:02",
"isMouseDown:" : "NC 5/16/2020 13:16",
"keyDown:" : "K.P. 6/25/2021 00:06",
"keyUp:" : "K.P. 6/25/2021 00:02",
"maximumSize" : "CS 5/19/2021 19:50",
"mouseDown:" : "ms 6/24/2021 10:34",
"mouseEnterDragging:" : "CS 6/11/2021 19:55",
"mouseLeaveDragging:" : "CS 6/11/2021 19:54",
"mouseMove:" : "mFr 6/16/2021 16:46",
"mouseUp:" : "ms 6/24/2021 10:34",
"mouseWheel:" : "K.P. 6/25/2021 00:29",
"relativeMousePosition:" : "mp 5/15/2020 12:42",
"setCanvasSize:" : "mFr 6/24/2021 16:30",
"updateExtent" : "mFr 6/24/2021 15:22",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
],
"commentStamp" : "wr 8/4/2020 12:56",
"instvars" : [
"ctrlPressed",
"gripMorph",
"viewPort" ],
"name" : "M2Canvas",
Expand Down

0 comments on commit e935863

Please sign in to comment.