Add access to bounds/content bounds from a scrollable viewport. (#2072)

* 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.
This commit is contained in:
Nick 2023-09-06 21:50:59 -04:00 committed by GitHub
parent 6fc88c3c80
commit e5afaa0892
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 {