MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ on_drag()

void MayaFlux::Portal::Forma::Context::on_drag ( uint32_t  id,
IO::MouseButtons  btn,
MoveFn  fn 
)

Called on each mouse-move event while btn is held, tracking the element where the drag began even when the cursor leaves its bounds.

Drag tracking begins when the element is first hit (either at initial press or first drag motion while button is held). Once tracking starts, the callback continues to fire with the current cursor position until the button is released, regardless of whether the cursor remains over the element.

This matches standard UI expectations for sliders, scrollbars, resize handles, and other controls that must respond continuously during a drag gesture.

Backed by Kriya::mouse_dragged, which gates on button state natively.

Parameters
idElement id to bind to.
btnMouse button that must be held.
fnCallback receiving element id and current NDC cursor position (which may be outside the element's bounds during drag).

Definition at line 48 of file Context.cpp.

49{
50 m_callbacks[id].drag[static_cast<int>(btn)] = std::move(fn);
51}
std::unordered_map< uint32_t, ElementCallbacks > m_callbacks
Definition Context.hpp:252

References m_callbacks.

Referenced by MayaFlux::Portal::Forma::Geometry::wire_canvas_drag().

+ Here is the caller graph for this function: