Skip to content

Commit

Permalink
Add access to bounds/content bounds from a scrollable viewport. (#2072)
Browse files Browse the repository at this point in the history
* Add access to bounds/content bounds from a scrollable viewport in order to perform certain scrollable optimizations as a consumer.

* Move bounds/content_bounds after relative_offset as per feedback.
  • Loading branch information
dtzxporter authored Sep 7, 2023
1 parent 6fc88c3 commit e5afaa0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions widget/src/scrollable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1146,6 +1146,16 @@ impl Viewport {

RelativeOffset { x, y }
}

/// Returns the bounds of the current [`Viewport`].
pub fn bounds(&self) -> Rectangle {
self.bounds
}

/// Returns the content bounds of the current [`Viewport`].
pub fn content_bounds(&self) -> Rectangle {
self.content_bounds
}
}

impl State {
Expand Down

0 comments on commit e5afaa0

Please sign in to comment.