pub struct ScaleEvent {
pub phase: ScalePhase,
pub scale_delta: f64,
pub focal: Point,
pub velocity: f64,
}Expand description
A scale (pinch/zoom) gesture event — InputEvent::Scroll’s hit-tested
sibling, carrying a multiplicative delta and a focal point rather than
an additive one.
Any source that reports a scale-factor change rather than individual
contact moves reduces to this one event — a desktop shell’s ctrl/⌘+wheel
mapping, macOS’s PinchGesture, and eventually a touch two-finger pinch
recognizer — so a widget reacts to pinch-to-zoom the same way regardless
of input device.
Fields§
§phase: ScalePhaseThe gesture phase.
scale_delta: f64The multiplicative scale change this event represents — not a running
total. A consumer multiplies its own accumulated scale by this value
each time an event arrives: 1.0 is a no-op, >1.0 zooms in, <1.0
zooms out.
focal: PointWhere the gesture is centered, in the receiving widget’s local
logical space — the point that must stay visually fixed while scale
changes. Translated like InputEvent::Pointer’s position by the
container chain that routes it (see InputEvent::translated).
velocity: f64The gesture’s current rate of scale change, per second. 0.0 when the
source reports none — every shipped desktop source today, since
neither a wheel notch nor winit’s PinchGesture carries a velocity —
reserved for a recognizer that tracks contact velocity directly.