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

Alternative scrollview implementation (doesn't use "origin" for scroll offset) #155

Merged
merged 10 commits into from
Feb 29, 2024

Conversation

nicoburns
Copy link
Contributor

No description provided.

Copy link
Contributor

@Philipp-M Philipp-M left a comment

Choose a reason for hiding this comment

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

Apart from all the nitpicks, this LGTM, thanks :)

src/widget/core.rs Outdated Show resolved Hide resolved
let child_size = self.child.layout(cx, child_proposed);
Size::new(child_size.width, proposed_size.height)
fn layout(&mut self, cx: &mut LayoutCx, bc: &BoxConstraints) -> Size {
cx.request_paint();
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this necessary even, when the layout hasn't changed at all?

(I see this is done in other widgets as well though, maybe a point to keep in mind later for optimization etc.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure if this is the best way of doing it. But I was seeing the visual rendering on screen failing to update properly before I put this in.

src/widget/scroll_view.rs Outdated Show resolved Hide resolved
src/widget/scroll_view.rs Outdated Show resolved Hide resolved
Copy link
Member

@xStrom xStrom left a comment

Choose a reason for hiding this comment

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

Read through it and played around with the example, looks like a good step forward. 👍

I also like this more than #146, because it's closer to how Druid did it. The power of familiarity.

src/widget/core.rs Outdated Show resolved Hide resolved
@xorgy
Copy link
Contributor

xorgy commented Feb 29, 2024

I've updated this to work against the upstream enumerated wheel delta type. The medium term idea is that general purpose scroll gestures will eventually be abstracted into the platform, because they will become rather complex when we start implementing kinetic scrolling (on platforms where it doesn't come for free) and touchscreen scrolling.

Copy link
Contributor

@xorgy xorgy left a comment

Choose a reason for hiding this comment

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

This is a good start, and doesn't regress anything.

@xorgy xorgy added this pull request to the merge queue Feb 29, 2024
Merged via the queue into main with commit a13a814 Feb 29, 2024
7 checks passed
@DJMcNab DJMcNab deleted the scrollview-without-origin branch March 1, 2024 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants