ui_events/scroll/mod.rs
1// Copyright 2025 the UI Events Authors
2// SPDX-License-Identifier: Apache-2.0 OR MIT
3
4use dpi::PhysicalPosition;
5
6/// Scroll delta.
7///
8/// Deltas are in a Y-down coordinate system, and represent a ‘navigation’
9/// direction; a positive Y value means that the viewport should move downward
10/// relative to the content.
11///
12/// For mouse wheel events, only `LineDelta` and `PixelDelta` are typical.
13/// For scroll deltas generated by scrollbars or other elements, `PageDelta`
14/// may be used (for example, when clicking in the well of the scrollbar).
15#[derive(Clone, Copy, Debug, PartialEq)]
16pub enum ScrollDelta {
17 /// Page delta.
18 ///
19 /// Page deltas are almost always synthetic, typically generated by clicking
20 /// in the well of a scrollbar.
21 PageDelta(f32, f32),
22 /// Line delta.
23 LineDelta(f32, f32),
24 /// Pixel delta.
25 PixelDelta(PhysicalPosition<f64>),
26}