diff --git a/README.md b/README.md index f7864ec..f0e07b7 100644 --- a/README.md +++ b/README.md @@ -34,22 +34,22 @@ For additional Developer Capabilities compile the application with the following $ nimble build -d:developer ``` -This will enable reloading the shaders with `Ctrl+R`. The shader files (`frag.glsl` and `vert.glsl`) should be located in the same folder as `boomer.nim` for this feature to work. If the shader files not found the program won't even start. +This will enable reloading the shaders with `Ctrl+R`. The shader files (`frag.glsl` and `vert.glsl`) should be located in the same folder as `boomer.nim` for this feature to work. If the shader files not found the program won't even start. **Keep in mind that the developer build is not suitable for day-to-day usage because it creates the external dependency on the shader files. Compiling the program without `-d:developer` "bakes" the shaders into the executable and eliminates the dependency.** ## Controls -| Control | Description | -|--------------------------------|---------------------------------------------------------------| -| 0 | Reset the application state (position, scale, velocity, etc). | -| q or ESC | Quit the application. | -| r | Reload configuration. | -| Ctrl + r | Reload the shaders (only for Developer mode) | -| f | Toggle flashlight effect. | -| Drag with left mouse button | Move the image around. | -| Scroll wheel | Zoom in/out. | -| Ctrl + Scroll wheel | Change the radious of the flaslight. | +| Control | Description | +|-------------------------------------------|---------------------------------------------------------------| +| 0 | Reset the application state (position, scale, velocity, etc). | +| q or ESC | Quit the application. | +| r | Reload configuration. | +| Ctrl + r | Reload the shaders (only for Developer mode) | +| f | Toggle flashlight effect. | +| Drag with left mouse button | Move the image around. | +| Scroll wheel or =/- | Zoom in/out. | +| Ctrl + Scroll wheel | Change the radious of the flaslight. | ## Configuration diff --git a/src/boomer.nim b/src/boomer.nim index 809056e..c250ffc 100644 --- a/src/boomer.nim +++ b/src/boomer.nim @@ -445,6 +445,21 @@ proc main() = var xev: TXEvent while XPending(display) > 0: discard XNextEvent(display, addr xev) + + proc scrollUp() = + if (xev.xkey.state and ControlMask) > 0.uint32 and flashlight.isEnabled: + flashlight.deltaRadius += 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 + else: + camera.deltaScale -= config.scrollSpeed + camera.scalePivot = mouse.curr + case xev.theType of Expose: discard @@ -470,6 +485,8 @@ proc main() = of KeyPress: var key = XLookupKeysym(cast[PXKeyEvent](xev.addr), 0) case key + of XK_EQUAL: scrollUp() + of XK_MINUS: scrollDown() of XK_0: camera.scale = 1.0 camera.deltaScale = 0.0 @@ -507,21 +524,8 @@ proc main() = mouse.prev = mouse.curr mouse.drag = true camera.velocity = vec2(0.0, 0.0) - - of Button4: # Scroll up - if (xev.xkey.state and ControlMask) > 0.uint32 and flashlight.isEnabled: - flashlight.deltaRadius += INITIAL_FL_DELTA_RADIUS - else: - camera.deltaScale += config.scrollSpeed - camera.scalePivot = mouse.curr - - of Button5: # Scoll down - if (xev.xkey.state and ControlMask) > 0.uint32 and flashlight.isEnabled: - flashlight.deltaRadius -= INITIAL_FL_DELTA_RADIUS - else: - camera.deltaScale -= config.scrollSpeed - camera.scalePivot = mouse.curr - + of Button4: scrollUp() + of Button5: scrollDown() else: discard