summaryrefslogtreecommitdiffstats
path: root/widget/src/scrollable.rs
diff options
context:
space:
mode:
authorLibravatar Nick <dtzxporter@users.noreply.github.com>2023-09-06 21:50:59 -0400
committerLibravatar GitHub <noreply@github.com>2023-09-07 01:50:59 +0000
commite5afaa08924cb0f34789b5a7de1720dc91978923 (patch)
tree1738fcd6d41e5dcbda6491fd8e571fc160b17c3d /widget/src/scrollable.rs
parent6fc88c3c80385b6d7289e8aecff4e3822519e657 (diff)
downloadiced-e5afaa08924cb0f34789b5a7de1720dc91978923.tar.gz
iced-e5afaa08924cb0f34789b5a7de1720dc91978923.tar.bz2
iced-e5afaa08924cb0f34789b5a7de1720dc91978923.zip
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.
Diffstat (limited to 'widget/src/scrollable.rs')
-rw-r--r--widget/src/scrollable.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/widget/src/scrollable.rs b/widget/src/scrollable.rs
index a83ed985..d0c77e6b 100644
--- a/widget/src/scrollable.rs
+++ b/widget/src/scrollable.rs
@@ -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 {