1#ifndef YAZE_APP_GUI_CANVAS_CANVAS_TOUCH_HANDLER_H
2#define YAZE_APP_GUI_CANVAS_CANVAS_TOUCH_HANDLER_H
5#include "imgui/imgui.h"
68 void Initialize(
const std::string& canvas_id =
"");
Handles touch input integration for Canvas.
bool WasTapped() const
Check if a tap gesture occurred this frame.
void SetScrollOffset(ImVec2 offset)
Set the scroll offset (e.g., from Canvas state)
Config & GetConfig()
Get configuration reference for modification.
void SetScale(float scale)
Set the zoom scale.
float GetScale() const
Get the current zoom scale.
bool IsTouchMode() const
Check if we're in touch mode (vs mouse)
const Config & GetConfig() const
void ApplyScrollDelta(ImVec2 delta)
Apply a scroll delta (add to current offset)
ImVec2 GetZoomCenter() const
Get the zoom center point (for pivot-based zooming)
void ProcessGesture(const GestureState &gesture)
void ApplyZoomDelta(float delta, ImVec2 center)
Apply a zoom delta around a center point.
void Update()
Update touch state each frame.
bool WasLongPressed() const
Check if a long-press gesture occurred this frame.
ImVec2 GetScrollOffset() const
Get the current scroll/pan offset for the canvas.
void Initialize(const std::string &canvas_id="")
Initialize the touch handler.
ImVec2 GetGesturePosition() const
Get the position of the last tap/gesture.
void Reset()
Reset to default state (no pan, 1.0 scale)
CanvasTouchHandler()=default
bool IsTouchActive() const
Check if touch input is currently active.
bool WasDoubleTapped() const
Check if a double-tap gesture occurred this frame.
void ProcessForCanvas(ImVec2 canvas_p0, ImVec2 canvas_sz, bool is_hovered)
Process touch gestures for the current canvas bounds.
Configuration for canvas touch behavior.
float inertia_deceleration
float inertia_min_velocity
Gesture recognition result.