Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Sep 7, 2023
Merged

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

merged 2 commits into from
Sep 7, 2023

Conversation

dtzxporter
Copy link
Contributor

Added access to the bounds and content bounds of a scrollable's viewport. This is necessary to perform some scrollable optimizations such as virtual lists without creating your own widget, and piggybacking on the scrollable.

Added 2 methods for accessing the corresponding bounds from Viewport.

…er to perform certain scrollable optimizations as a consumer.
Comment on lines 1140 to 1148
/// 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
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move these after relative_offset.

@hecrj hecrj added this to the 0.12.0 milestone Sep 7, 2023
Copy link
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thanks.

@hecrj hecrj enabled auto-merge (squash) September 7, 2023 01:38
@hecrj hecrj merged commit e5afaa0 into iced-rs:master Sep 7, 2023
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants