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

◆ apply_pan_zoom_pan()

MAYAFLUX_API void MayaFlux::Kinesis::apply_pan_zoom_pan ( PanZoom2DState state,
float  dx,
float  dy,
float  viewport_width,
float  viewport_height 
)

Pan by a pixel delta, scaled to world units by the current zoom level.

Scaling by zoom ensures pan speed stays proportionate to zoom level.

Parameters
statePanZoom2D state (pan mutated).
dxHorizontal pixel delta (positive = right).
dyVertical pixel delta (positive = up).
viewport_widthFramebuffer width in pixels.
viewport_heightFramebuffer height in pixels.

Definition at line 31 of file PanZoom2DState.cpp.

33{
34 const float aspect = viewport_width / viewport_height;
35 st.pan.x -= (dx / viewport_width) * (2.0F * st.zoom * aspect);
36 st.pan.y += (dy / viewport_height) * (2.0F * st.zoom);
37}

References MayaFlux::Kinesis::PanZoom2DState::pan, and MayaFlux::Kinesis::PanZoom2DState::zoom.

Referenced by MayaFlux::bind_pan_zoom_preset().

+ Here is the caller graph for this function: