pub struct DoubleAxisScrollElementManager { /* private fields */ }Expand description
Per-element two-axis scroll manager with wheel, optional drag, and clamping.
Combines wheel deltas from FullElementScrollState::get_mouse_wheel_move_v
with optional mouse-drag scrolling when button is Some. Drag delta is
current_mouse_pos − previous_mouse_pos; no delta is produced on the first
frame the button is held.
When the parent element is hovered but not yet pressed, hover on any
child_elements suppresses parent drag capture so children receive priority.
Scroll position is clamped to [−limits, 0] per axis after each update.
Implementations§
Source§impl DoubleAxisScrollElementManager
impl DoubleAxisScrollElementManager
Sourcepub fn new(
algorithms: [ScrollAlgorithm; 2],
id: ElementId,
child_elements: Vec<ElementId>,
button: Option<MouseButton>,
) -> Self
pub fn new( algorithms: [ScrollAlgorithm; 2], id: ElementId, child_elements: Vec<ElementId>, button: Option<MouseButton>, ) -> Self
Creates a scroll manager for id.
algorithms— per-axis scroll algorithms; index0horizontal,1vertical.child_elements— child IDs that take hover priority over parent drag.button— mouse button for drag scrolling;Nonedisables drag.
Sourcepub fn update(&mut self, provider: &dyn FullElementScrollState, dt: f32)
pub fn update(&mut self, provider: &dyn FullElementScrollState, dt: f32)
Advances scroll state for one frame.
No-op when layout bounds or internal size are unavailable for id.
Sourcepub fn get_position(&self) -> Vector2
pub fn get_position(&self) -> Vector2
Returns the current clamped scroll offset.
Auto Trait Implementations§
impl Freeze for DoubleAxisScrollElementManager
impl RefUnwindSafe for DoubleAxisScrollElementManager
impl Send for DoubleAxisScrollElementManager
impl Sync for DoubleAxisScrollElementManager
impl Unpin for DoubleAxisScrollElementManager
impl UnsafeUnpin for DoubleAxisScrollElementManager
impl UnwindSafe for DoubleAxisScrollElementManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more