pub struct ScrollManager { /* private fields */ }Expand description
Manages all scroll state and animations for a window
Implementations§
Source§impl ScrollManager
impl ScrollManager
Sourcepub fn begin_frame(&mut self)
pub fn begin_frame(&mut self)
Prepares state for a new frame by saving current offsets as previous
Sourcepub fn end_frame(&self) -> FrameScrollInfo
pub fn end_frame(&self) -> FrameScrollInfo
Returns scroll activity summary for the completed frame
Sourcepub fn tick(&mut self, now: Instant) -> ScrollTickResult
pub fn tick(&mut self, now: Instant) -> ScrollTickResult
Advances scroll animations by one tick, returns repaint info
Sourcepub fn process_scroll_event(&mut self, event: ScrollEvent, now: Instant) -> bool
pub fn process_scroll_event(&mut self, event: ScrollEvent, now: Instant) -> bool
Processes a scroll event, applying immediate or animated scroll
Sourcepub fn record_sample(
&mut self,
delta_x: f32,
delta_y: f32,
hover_manager: &HoverManager,
input_point_id: &InputPointId,
now: Instant,
) -> Option<(DomId, NodeId)>
pub fn record_sample( &mut self, delta_x: f32, delta_y: f32, hover_manager: &HoverManager, input_point_id: &InputPointId, now: Instant, ) -> Option<(DomId, NodeId)>
Records a scroll input sample and applies it to the first scrollable node under the cursor
Finds the first scrollable node in the hit test hierarchy and applies the scroll delta. Returns the scrolled node if successful.
Sourcepub fn get_scroll_delta(
&self,
dom_id: DomId,
node_id: NodeId,
) -> Option<LogicalPosition>
pub fn get_scroll_delta( &self, dom_id: DomId, node_id: NodeId, ) -> Option<LogicalPosition>
Returns the scroll delta applied this frame, if non-zero
Sourcepub fn had_scroll_activity_for_node(
&self,
dom_id: DomId,
node_id: NodeId,
) -> bool
pub fn had_scroll_activity_for_node( &self, dom_id: DomId, node_id: NodeId, ) -> bool
Returns true if the node had scroll activity this frame
Sourcepub fn set_scroll_position(
&mut self,
dom_id: DomId,
node_id: NodeId,
position: LogicalPosition,
now: Instant,
)
pub fn set_scroll_position( &mut self, dom_id: DomId, node_id: NodeId, position: LogicalPosition, now: Instant, )
Sets scroll position immediately (no animation)
Sourcepub fn scroll_by(
&mut self,
dom_id: DomId,
node_id: NodeId,
delta: LogicalPosition,
duration: Duration,
easing: EasingFunction,
now: Instant,
)
pub fn scroll_by( &mut self, dom_id: DomId, node_id: NodeId, delta: LogicalPosition, duration: Duration, easing: EasingFunction, now: Instant, )
Scrolls by a delta amount with animation
Sourcepub fn scroll_to(
&mut self,
dom_id: DomId,
node_id: NodeId,
target: LogicalPosition,
duration: Duration,
easing: EasingFunction,
now: Instant,
)
pub fn scroll_to( &mut self, dom_id: DomId, node_id: NodeId, target: LogicalPosition, duration: Duration, easing: EasingFunction, now: Instant, )
Scrolls to an absolute position with animation
If duration is zero, the position is set immediately without animation.
Sourcepub fn update_node_bounds(
&mut self,
dom_id: DomId,
node_id: NodeId,
container_rect: LogicalRect,
content_rect: LogicalRect,
now: Instant,
)
pub fn update_node_bounds( &mut self, dom_id: DomId, node_id: NodeId, container_rect: LogicalRect, content_rect: LogicalRect, now: Instant, )
Updates the container and content bounds for a scrollable node
Sourcepub fn get_current_offset(
&self,
dom_id: DomId,
node_id: NodeId,
) -> Option<LogicalPosition>
pub fn get_current_offset( &self, dom_id: DomId, node_id: NodeId, ) -> Option<LogicalPosition>
Returns the current scroll offset for a node
Sourcepub fn get_last_activity_time(
&self,
dom_id: DomId,
node_id: NodeId,
) -> Option<Instant>
pub fn get_last_activity_time( &self, dom_id: DomId, node_id: NodeId, ) -> Option<Instant>
Returns the timestamp of last scroll activity for a node
Sourcepub fn get_scroll_state(
&self,
dom_id: DomId,
node_id: NodeId,
) -> Option<&AnimatedScrollState>
pub fn get_scroll_state( &self, dom_id: DomId, node_id: NodeId, ) -> Option<&AnimatedScrollState>
Returns the internal scroll state for a node
Sourcepub fn get_scroll_states_for_dom(
&self,
dom_id: DomId,
) -> BTreeMap<NodeId, ScrollPosition>
pub fn get_scroll_states_for_dom( &self, dom_id: DomId, ) -> BTreeMap<NodeId, ScrollPosition>
Returns all scroll positions for nodes in a specific DOM
Sourcepub fn register_or_update_scroll_node(
&mut self,
dom_id: DomId,
node_id: NodeId,
container_rect: LogicalRect,
content_size: LogicalSize,
now: Instant,
)
pub fn register_or_update_scroll_node( &mut self, dom_id: DomId, node_id: NodeId, container_rect: LogicalRect, content_size: LogicalSize, now: Instant, )
Registers or updates a scrollable node with its container and content sizes. This should be called after layout for each node that has overflow:scroll or overflow:auto with overflowing content.
If the node already exists, updates container/content rects without changing scroll offset. If the node is new, initializes with zero scroll offset.
Sourcepub fn register_scroll_node(
&mut self,
dom_id: DomId,
node_id: NodeId,
) -> ExternalScrollId
pub fn register_scroll_node( &mut self, dom_id: DomId, node_id: NodeId, ) -> ExternalScrollId
Register a scroll node and get its ExternalScrollId for WebRender. If the node already has an ID, returns the existing one.
Sourcepub fn get_external_scroll_id(
&self,
dom_id: DomId,
node_id: NodeId,
) -> Option<ExternalScrollId>
pub fn get_external_scroll_id( &self, dom_id: DomId, node_id: NodeId, ) -> Option<ExternalScrollId>
Get the ExternalScrollId for a node (returns None if not registered)
Sourcepub fn iter_external_scroll_ids(
&self,
) -> impl Iterator<Item = ((DomId, NodeId), ExternalScrollId)> + '_
pub fn iter_external_scroll_ids( &self, ) -> impl Iterator<Item = ((DomId, NodeId), ExternalScrollId)> + '_
Iterate over all registered external scroll IDs
Sourcepub fn calculate_scrollbar_states(&mut self)
pub fn calculate_scrollbar_states(&mut self)
Calculate scrollbar states for all visible scrollbars. This should be called once per frame after layout is complete.
Sourcepub fn get_scrollbar_state(
&self,
dom_id: DomId,
node_id: NodeId,
orientation: ScrollbarOrientation,
) -> Option<&ScrollbarState>
pub fn get_scrollbar_state( &self, dom_id: DomId, node_id: NodeId, orientation: ScrollbarOrientation, ) -> Option<&ScrollbarState>
Get scrollbar state for hit-testing
Sourcepub fn iter_scrollbar_states(
&self,
) -> impl Iterator<Item = ((DomId, NodeId, ScrollbarOrientation), &ScrollbarState)> + '_
pub fn iter_scrollbar_states( &self, ) -> impl Iterator<Item = ((DomId, NodeId, ScrollbarOrientation), &ScrollbarState)> + '_
Iterate over all visible scrollbar states
Sourcepub fn hit_test_scrollbar(
&self,
dom_id: DomId,
node_id: NodeId,
global_pos: LogicalPosition,
) -> Option<ScrollbarHit>
pub fn hit_test_scrollbar( &self, dom_id: DomId, node_id: NodeId, global_pos: LogicalPosition, ) -> Option<ScrollbarHit>
Hit-test scrollbars for a specific node at the given position. Returns Some if the position is inside a scrollbar for this node.
Sourcepub fn hit_test_scrollbars(
&self,
global_pos: LogicalPosition,
) -> Option<ScrollbarHit>
pub fn hit_test_scrollbars( &self, global_pos: LogicalPosition, ) -> Option<ScrollbarHit>
Perform hit-testing for all scrollbars at the given global position.
This iterates through all visible scrollbars in reverse z-order (top to bottom) and returns the first hit. Use this when you don’t know which node to check.
For better performance, use hit_test_scrollbar() when you already have
a hit-tested node from WebRender.
Source§impl ScrollManager
impl ScrollManager
Trait Implementations§
Source§impl Clone for ScrollManager
impl Clone for ScrollManager
Source§fn clone(&self) -> ScrollManager
fn clone(&self) -> ScrollManager
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ScrollManager
impl Debug for ScrollManager
Source§impl Default for ScrollManager
impl Default for ScrollManager
Source§fn default() -> ScrollManager
fn default() -> ScrollManager
Source§impl EventProvider for ScrollManager
impl EventProvider for ScrollManager
Source§fn get_pending_events(&self, timestamp: Instant) -> Vec<SyntheticEvent>
fn get_pending_events(&self, timestamp: Instant) -> Vec<SyntheticEvent>
Get pending scroll events.
Returns Scroll/ScrollStart/ScrollEnd events for nodes whose scroll position changed this frame.
Auto Trait Implementations§
impl Freeze for ScrollManager
impl RefUnwindSafe for ScrollManager
impl Send for ScrollManager
impl Sync for ScrollManager
impl Unpin for ScrollManager
impl UnwindSafe for ScrollManager
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more