Skip to main content

rosace_scroll/
lib.rs

1//! Momentum scroll view for ROSACE.
2//!
3//! # Quick start
4//!
5//! ```rust,no_run
6//! use rosace_scroll::{ScrollView, ScrollDirection, ScrollPhysics};
7//!
8//! let mut sv = ScrollView::new(400.0, 600.0)
9//!     .content_size(400.0, 2000.0)
10//!     .direction(ScrollDirection::Vertical)
11//!     .physics(ScrollPhysics::Momentum { friction: 0.92 });
12//!
13//! // On scroll input:
14//! sv.on_scroll(0.0, 15.0);
15//!
16//! // Each frame:
17//! sv.tick(0.016);
18//!
19//! // Translate content by the returned offset before drawing:
20//! let [_ox, _oy] = sv.scroll_offset();
21//! ```
22
23pub mod controller;
24pub mod physics;
25pub mod scrollbar;
26pub mod scroll_view;
27
28pub use controller::ScrollController;
29pub use physics::{
30    clamp_offset, snap_to_page, MomentumState, ScrollDirection, ScrollPhysics, ScrollStyle,
31};
32pub use scrollbar::{render_scrollbar, ScrollbarMetrics};
33pub use scroll_view::ScrollView;