MayaFlux 1.0.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.

Driven by the same motion event as on_move, for every button the window's event source reports as held.

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 53 of file Context.cpp.

54{
55 m_callbacks[id].drag[static_cast<int>(btn)] = std::move(fn);
56}
std::unordered_map< uint32_t, ElementCallbacks > m_callbacks
Definition Context.hpp:361

References m_callbacks.

Referenced by MayaFlux::Portal::Forma::Scrollable::indicator(), MayaFlux::Portal::Forma::Geometry::wire_canvas_drag(), and wire_drag().

+ Here is the caller graph for this function: