From 6c8392aa61f07586b70aeda11551654adee05845 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9ana?= Date: Fri, 21 Aug 2026 23:09:33 +0200 Subject: [PATCH] reduce flashlight radius during dragging This gives it a feedback to the click, I think it's nice. Thanks for the project. --- src/boomer.nim | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/boomer.nim b/src/boomer.nim index a44b744..1955b7e 100644 --- a/src/boomer.nim +++ b/src/boomer.nim @@ -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 @@ -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) @@ -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