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

◆ key_step()

Context & MayaFlux::Portal::Forma::Context::key_step ( uint32_t  id,
std::shared_ptr< MappedState< float > >  state,
IO::Keys  decrease,
IO::Keys  increase,
float  delta,
float  clamp_min = 0.0F,
float  clamp_max = 1.0F 
)

Attach key-delta handlers to a Mapped<float> element.

Binds key handlers that adjust the element's state by a delta on each press/hold. The element must be focused (via mouse click) for keys to fire.

Parameters
idElement id.
stateMappedState to adjust.
decreaseKey that decreases the value.
increaseKey that increases the value.
deltaStep size per key event.
clamp_minMinimum clamped value (default 0.0F).
clamp_maxMaximum clamped value (default 1.0F).
Returns
*this for chaining.

Definition at line 193 of file Context.cpp.

201{
202 on_held(id, decrease, [state, delta, clamp_min, clamp_max](uint32_t) {
203 state->write(std::clamp(state->value - delta, clamp_min, clamp_max));
204 });
205
206 on_held(id, increase, [state, delta, clamp_min, clamp_max](uint32_t) {
207 state->write(std::clamp(state->value + delta, clamp_min, clamp_max));
208 });
209
210 return *this;
211}
void on_held(uint32_t id, IO::Keys key, KeyFn fn)
Called repeatedly while a key is held and the element has focus.
Definition Context.cpp:105

References on_held().

+ Here is the call graph for this function: