MaterialSheetAnchors
struct · ferroui-themes-material · v0.5.0
struct MaterialSheetAnchors
Sheet top coordinates in a viewport, expressed in device-independent pixels.
The partial and expanded coordinates may be equal. Do not use a map keyed by floating-point position to represent the semantic states: it loses information.
Members
hiddenpartially_expandedexpandedPOSITIONAL_THRESHOLDVELOCITY_THRESHOLDVELOCITY_DAMPING_ZONEnewoffsetpartial_matches_expandedreconcile_targetsettle_targetdamp_velocity
hidden
hidden: f64
partially_expanded
partially_expanded: f64
expanded
expanded: f64
POSITIONAL_THRESHOLD
const POSITIONAL_THRESHOLD: f64
VELOCITY_THRESHOLD
const VELOCITY_THRESHOLD: f64
VELOCITY_DAMPING_ZONE
const VELOCITY_DAMPING_ZONE: f64
new
fn new(viewport_height: f64, sheet_height: f64) -> Self
Recomputes anchors for the current usable viewport and measured sheet. Nonfinite dimensions are treated as zero; oversized sheets fill the viewport.
offset
fn offset(self: Self, state: MaterialSheetState) -> f64
partial_matches_expanded
fn partial_matches_expanded(self: Self) -> bool
reconcile_target
fn reconcile_target(self: Self, previous: Self, target: MaterialSheetState, partial_enabled: bool) -> MaterialSheetState
Preserves the fully visible short-sheet state when its content grows.
settle_target
fn settle_target(self: Self, current: MaterialSheetState, offset: f64, velocity: f64, partial_enabled: bool, allow_hidden: bool) -> MaterialSheetState
Chooses an adjacent legal anchor using the source's 56dp / 125dp/s thresholds.
A high-velocity fling follows its direction; a slow drag must cross the
positional threshold from the last settled state. Large drags can traverse
multiple anchors. allow_hidden=false is useful for persistent sheets.
damp_velocity
fn damp_velocity(self: Self, offset: f64, velocity: f64, maximum_velocity: f64) -> f64
Damps downward fling energy in the source's 125dp hidden-boundary zone. The source preserves the fling threshold once it has already been crossed.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedPropertyValueAnyValueClassDefaultsErasedDestructorIntoEitherCastableFrom<ST, Uninit, Uninit>CastableFrom<ST, Initialized, Initialized>Read<Exclusive, BecauseExclusive>CloneCopyDebugDefaultStructuralPartialEqPartialEq
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.