Skip to content

Commit

Permalink
move speed now depends on zoom level
Browse files Browse the repository at this point in the history
  • Loading branch information
KnorrFG committed Sep 21, 2021
1 parent 5a52e8c commit 687b56d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/session_planer.nim
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ proc main() =

drawWin.add(drawing)
drawWin.onKeyDown = proc(event: KeyboardEvent) =
let moveFactor = 0.2 * rtInfo.viewPort.w * rtInfo.viewPort.h * (
if Key_Shift.isDown(): 2 else: 1)
event.handled = true
if Key_Minus.isDown() or Key_NumpadSubtract.isDown():
rtInfo.viewPort.w *= 1.1
Expand All @@ -237,16 +239,16 @@ proc main() =
rtInfo.viewPort.h *= 0.9
updateGraph(forced=true, updateDrawTimestamp=false)
elif Key_Left.isDown():
rtInfo.viewPort.x -= 0.1
rtInfo.viewPort.x -= moveFactor
updateGraph(forced=true, updateDrawTimestamp=false)
elif Key_Right.isDown():
rtInfo.viewPort.x += 0.1
rtInfo.viewPort.x += moveFactor
updateGraph(forced=true, updateDrawTimestamp=false)
elif Key_Up.isDown():
rtInfo.viewPort.y -= 0.1
rtInfo.viewPort.y -= moveFactor
updateGraph(forced=true, updateDrawTimestamp=false)
elif Key_Down.isDown():
rtInfo.viewPort.y += 0.1
rtInfo.viewPort.y += moveFactor
updateGraph(forced=true, updateDrawTimestamp=false)
else:
event.handled = false
Expand Down

0 comments on commit 687b56d

Please sign in to comment.