Skip to main content

lumen_primitives/
physics.rs

1//! Per-OS physics constants used by the scroll, drag, and press primitives.
2//!
3//! Values sourced from `NSScrollView` (macOS) and `IInertiaProcessor` (Windows); see `PHYSICS.md`.
4
5/// Inertia decay (1/s). Higher = stops faster. Per-OS.
6#[allow(clippy::if_same_then_else)]
7pub const INERTIA_DECAY: f32 = if cfg!(target_os = "macos") {
8    6.0
9} else if cfg!(target_os = "windows") {
10    8.0
11} else {
12    8.0
13};
14
15/// Rubber-band stiffness applied when scroll position exceeds bounds.
16/// Higher = stiffer pullback. Macs use rubber-band; Windows/Linux clamp.
17pub const RUBBER_BAND_STIFFNESS: f32 = if cfg!(target_os = "macos") { 0.55 } else { 0.0 };
18
19/// Lines-per-wheel-detent -> pixels conversion (used by the winit bridge to
20/// normalize `MouseScrollDelta::LineDelta`).
21pub const LINE_HEIGHT_PX: f32 = 32.0;