yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::editor::StickyWheelPan Struct Reference

#include <canvas_navigation_manager.h>

Public Member Functions

ImVec2 Consume (ImVec2 wheel, float dt, float step_px, float snap_px)
 

Public Attributes

ImVec2 residual {0.0f, 0.0f}
 
float idle_seconds = 0.0f
 

Detailed Description

Turns wheel/trackpad deltas into pan steps that land on whole detents.

Pure state machine (no ImGui calls) so the feel is unit-testable. Input below the deadzone is ignored, direction reversals drop the residual, and the residual is discarded once input stops for kOverworldWheelIdleResetSec.

Definition at line 30 of file canvas_navigation_manager.h.

Member Function Documentation

◆ Consume()

ImVec2 yaze::editor::StickyWheelPan::Consume ( ImVec2 wheel,
float dt,
float step_px,
float snap_px )
Parameters
wheelio.MouseWheelH / io.MouseWheel (positive = left / up).
step_pxpixels per wheel unit (a multiple of snap_px).
snap_pxdetent size in screen pixels.
Returns
scroll delta in screen pixels, always a multiple of snap_px.

Definition at line 412 of file canvas_navigation_manager.cc.

References idle_seconds, yaze::editor::kOverworldWheelDeadzone, yaze::editor::kOverworldWheelIdleResetSec, and residual.

Referenced by yaze::editor::CanvasNavigationManager::BeginCanvasViewport().

Member Data Documentation

◆ residual

ImVec2 yaze::editor::StickyWheelPan::residual {0.0f, 0.0f}

Definition at line 31 of file canvas_navigation_manager.h.

Referenced by Consume().

◆ idle_seconds

float yaze::editor::StickyWheelPan::idle_seconds = 0.0f

Definition at line 32 of file canvas_navigation_manager.h.

Referenced by Consume().


The documentation for this struct was generated from the following files: