Skip to content

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

Merged
hecrj merged 2 commits into
iced-rs:masterfrom
dtzxporter:scrollable-viewport-bounds
Sep 7, 2023
Merged

Add access to bounds/content bounds from a scrollable viewport.#2072
hecrj merged 2 commits into
iced-rs:masterfrom
dtzxporter:scrollable-viewport-bounds

Conversation

@dtzxporter

Copy link
Copy Markdown
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 thread widget/src/scrollable.rs Outdated
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
Copy Markdown
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

@hecrj hecrj left a comment

Copy link
Copy Markdown
Member

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