Skip to main content

push_scroll_to_signal

Function push_scroll_to_signal 

Source
pub fn push_scroll_to_signal(
    store: ResMut<'_, PropertyStore>,
    q: Query<'_, '_, (Entity, &BindScroll, Ref<'_, ScrollOffset>, Option<&Scroll>)>,
    removed: RemovedComponents<'_, '_, BindScroll>,
    pending: Local<'_, HashSet<Entity>>,
)
Expand description

Pushes the settled vertical ScrollOffset back into the matching PropertyStore entry for every BindScroll entity (W6 T6, the two-way half).

Throttle contract: not per-frame. A user drag / wheel fling mutates the offset every tick; pushing each intermediate value would spam the store (and re-run every derivation) at frame rate. Instead the system arms a pending entry while the offset keeps changing, and pushes once on settle: the first tick where the offset did not change and the container’s fling velocity has slept. Spawn-tick rows (is_added()) are skipped - the freshly-inserted offset is the widget default, not a user scroll (same rule as push_toggle_to_signal). The value is stringified like push_slider_to_signal so <if> comparators and interpolation keep working; the equality check keeps the signal->offset->signal round trip from echoing.