Struct ScrollZoomFilter
- Namespace
- LansMap.Core.Interaction
Device-agnostic filter between raw per-frame scroll input and a zoom-gesture's target math. Bounds the felt zoom rate with a token bucket (a burst budget plus a wall-clock refill rate) rather than a per-call clamp, and separates "the map should move now" from "the gesture is still meaningfully in progress" so a trackpad's inertia tail cannot indefinitely defer an end-of-gesture snap.
public struct ScrollZoomFilter
- Inherited Members
Remarks
Takes one raw scroll sample per call and returns an accepted delta
for immediate application every time - the accepted delta is never
held back waiting for a threshold. Only SignificantEvent,
meant to drive a caller's own quiet-period timer, is gated by a
minimum accumulated magnitude.
Fields
BurstCapacityNotches
public const double BurstCapacityNotches = 2
Field Value
MaxZoomRateLevelsPerSecond
public const double MaxZoomRateLevelsPerSecond = 8
Field Value
PhantomFloorNotches
public const double PhantomFloorNotches = 0.05
Field Value
Methods
Step(double, double)
Filters one raw scroll sample for a zoom gesture.
public (double AcceptedDelta, bool SignificantEvent) Step(double rawNotches, double dtSeconds)
Parameters
rawNotchesdoubleRaw scroll delta for this call, in wheel-notch units (1.0 = one detent).
dtSecondsdoubleWall-clock seconds elapsed since the PREVIOUS Step(double, double) call (refill time for the token bucket), not the time this call itself covers. NaN or negative refills nothing but still processes the sample - there is no early-return, and dt == 0 (back-to-back calls) is legal and expected.
Returns
- (double AcceptedDelta, bool SignificantEvent)
The accepted delta (burst/rate-capped, safe to apply to the zoom target immediately) and whether accumulated motion since the last significant event has crossed PhantomFloorNotches.