Skip to content
Open
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
16 changes: 12 additions & 4 deletions src/boomer.nim
Original file line number Diff line number Diff line change
Expand Up @@ -449,16 +449,22 @@ proc main() =
while XPending(display) > 0:
discard XNextEvent(display, addr xev)

proc increaseFlashlight(dsize: float32) =
if flashlight.isEnabled:
flashlight.deltaRadius += dsize
proc decreaseFlashlight(dsize: float32) =
if flashlight.isEnabled:
flashlight.deltaRadius -= dsize

proc scrollUp() =
if (xev.xkey.state and ControlMask) > 0.uint32 and flashlight.isEnabled:
flashlight.deltaRadius += INITIAL_FL_DELTA_RADIUS
if (xev.xkey.state and ControlMask) > 0.uint32:
increaseFlashlight(INITIAL_FL_DELTA_RADIUS)
else:
camera.deltaScale += config.scrollSpeed
camera.scalePivot = mouse.curr

proc scrollDown() =
if (xev.xkey.state and ControlMask) > 0.uint32 and flashlight.isEnabled:
flashlight.deltaRadius -= INITIAL_FL_DELTA_RADIUS
decreaseFlashlight(INITIAL_FL_DELTA_RADIUS)
else:
camera.deltaScale -= config.scrollSpeed
camera.scalePivot = mouse.curr
Expand Down Expand Up @@ -529,6 +535,7 @@ proc main() =
of ButtonPress:
case xev.xbutton.button
of Button1:
decreaseFlashlight(INITIAL_FL_DELTA_RADIUS / 2) # shrink the flashlight
mouse.prev = mouse.curr
mouse.drag = true
camera.velocity = vec2(0.0, 0.0)
Expand All @@ -540,6 +547,7 @@ proc main() =
of ButtonRelease:
case xev.xbutton.button
of Button1:
increaseFlashlight(INITIAL_FL_DELTA_RADIUS / 2) # restore the flashlight
mouse.drag = false
else:
discard
Expand Down