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

◆ wire_drag()

template<typename T >
void MayaFlux::Portal::Forma::Geometry::wire_drag ( Context ctx,
uint32_t  id,
std::shared_ptr< MappedState< T > >  state,
std::function< T(glm::vec2)>  project,
IO::MouseButtons  btn = IO::MouseButtons::Left 
)

Register a drag handler writing a projected cursor position to state.

The projection carries the geometry-specific mapping. Kinesis::Projection supplies the inverses matching the geometry functions above: axis_fraction for the faders, unit_square for position_picker, angle_fraction for radial, path_fraction for stroke_slider.

Parameters
ctxContext owning the element's callbacks.
idElement id returned from create_element.
stateMappedState written on each drag event.
projectNDC to value mapping.
btnMouse button that must be held.

Definition at line 26 of file FormFactory.hpp.

32{
33 if (!state || !project)
34 return;
35
36 ctx.wire_drag(
37 id,
38 [state = std::move(state), project = std::move(project)](glm::vec2 ndc) {
39 state->write(project(ndc));
40 },
41 btn);
42}
Context & wire_drag(uint32_t id, std::function< void(glm::vec2)> sink, IO::MouseButtons btn=IO::MouseButtons::Left)
Register a drag handler receiving only the cursor position.
Definition Context.cpp:173

References MayaFlux::Portal::Forma::Context::wire_drag().

+ Here is the call graph for this function: