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

Added flicked-Callback on Flickable #4626

Merged
merged 1 commit into from Feb 26, 2024

Conversation

pfzetto
Copy link
Contributor

@pfzetto pfzetto commented Feb 15, 2024

Hello,
as requested in #1462, I've added a scrolled-Callback that gets triggered when the viewport_x- or viewport_y -Properties are changed by a mouse drag or mouse wheel movement.

I was only able to test this change on the Rust API (by adding a debug statement to one of the examples), because my current Nix build setup isn't setup for C++, Python or NodeJs.

Thanks,
pfzetto

@CLAassistant
Copy link

CLAassistant commented Feb 15, 2024

CLA assistant check
All committers have signed the CLA.

@pfzetto
Copy link
Contributor Author

pfzetto commented Feb 15, 2024

Thinking about it,flicked may be a better name?

@ogoffart
Copy link
Member

Thanks a lot for the pull request.

As for the name, i think both scrolled and flicked are acceptable. Also not sure which one is better.

I noticed that you do not emit it in mouse move, is that intentional?

It should be documented in https://github.com/slint-ui/slint/blob/master/docs/reference/src/language/builtins/elements.md#flickable

Please also make a test.
For example adding something in https://github.com/slint-ui/slint/blob/master/tests/cases/elements/flickable.slint that does scrolled => { root.scrolled-called += 1; } and check it is called when it should. (see https://github.com/slint-ui/slint/blob/master/docs/testing.md#rust-driver for how to run the test with a filter)

As requested in slint-ui#1462, I've added a `flicked`-Callback that gets
triggered when the `viewport_x`- or `viewport_y` -Properties are changed
by a mouse drag or mouse wheel movement.
@pfzetto
Copy link
Contributor Author

pfzetto commented Feb 16, 2024

Hello,
I've previously didn't emit on mouse move because I thought of the Event to be triggered after the drag operation.
Thinking about it further, I added it because I think that it would feel weird to users when the content is only loaded after they finished dragging.
I've also decided to rename the callback to allow for separate dragged and scrolled callbacks in the future.

Thanks,
pfzetto

@pfzetto pfzetto changed the title Added scrolled-Callback on Flickable Added flicked-Callback on Flickable Feb 16, 2024
@ogoffart ogoffart merged commit 73e05ae into slint-ui:master Feb 26, 2024
35 checks passed
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

3 participants