@@ -3,8 +3,9 @@ Attribute VB_Name = "Tools_Move"
33'PhotoDemon Move/Size Tool Manager
44'Copyright 2014-2022 by Tanner Helland
55'Created: 24/May/14
6- 'Last updated: 09/April/18
7- 'Last update: migrate move tool bits out of pdCanvas and into a dedicated module
6+ 'Last updated: 22/December/22
7+ 'Last update: add some trivial key-handling bits for the Hand tool (which is a different tool, but it has
8+ ' so few features that it's easier to just condense things here)
89'
910'This module interfaces between the layer move/size UI and actual layer backend. Look in the relevant
1011' tool panel form for more details on how the UI relays relevant tool data here.
@@ -110,6 +111,32 @@ Public Sub NotifyKeyDown(ByVal Shift As ShiftConstants, ByVal vkCode As Long, By
110111
111112End Sub
112113
114+ 'We also cover hand tool key behavior in this module, despite it being a separate tool.
115+ ' (There is not currently a separate hand-tool module.)
116+ Public Sub NotifyKeyDown_HandTool (ByVal Shift As ShiftConstants , ByVal vkCode As Long , ByRef markEventHandled As Boolean )
117+
118+ 'Handle arrow keys as standard scroll events.
119+ If (vkCode = VK_UP) Or (vkCode = VK_DOWN) Or (vkCode = VK_LEFT) Or (vkCode = VK_RIGHT) Then
120+
121+ 'Set focus to the canvas (if it isn't already)
122+ FormMain.MainCanvas(0 ).SetFocusToCanvasView
123+
124+ If (vkCode = VK_UP) Then
125+ FormMain.MainCanvas(0 ).CanvasView_MouseWheelVertical 0 &, 0 &, FormMain.MainCanvas(0 ).GetLastMouseX, FormMain.MainCanvas(0 ).GetLastMouseY, 1 #
126+ ElseIf (vkCode = VK_DOWN) Then
127+ FormMain.MainCanvas(0 ).CanvasView_MouseWheelVertical 0 &, 0 &, FormMain.MainCanvas(0 ).GetLastMouseX, FormMain.MainCanvas(0 ).GetLastMouseY, -1 #
128+ ElseIf (vkCode = VK_LEFT) Then
129+ FormMain.MainCanvas(0 ).CanvasView_MouseWheelHorizontal 0 &, 0 &, FormMain.MainCanvas(0 ).GetLastMouseX, FormMain.MainCanvas(0 ).GetLastMouseY, -1 #
130+ ElseIf (vkCode = VK_RIGHT) Then
131+ FormMain.MainCanvas(0 ).CanvasView_MouseWheelHorizontal 0 &, 0 &, FormMain.MainCanvas(0 ).GetLastMouseX, FormMain.MainCanvas(0 ).GetLastMouseY, 1 #
132+ End If
133+
134+ markEventHandled = True
135+
136+ End If
137+
138+ End Sub
139+
113140Public Sub NotifyMouseDown (ByRef srcCanvas As pdCanvas , ByVal Shift As ShiftConstants , ByVal imgX As Single , ByVal imgY As Single )
114141
115142 'Failsafe check only
0 commit comments