slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
17.41k stars 592 forks source link

feature: fluent scrolling #4115

Open std-microblock opened 10 months ago

std-microblock commented 10 months ago

Fluent scrolling takes an important part of the user experience, but Slint doesn't seem to support it.

I'd appreciate it if fluent scrolling could be implemented in standard ScrollView. To be honest, I had to implement the ScrollView again by myself because of the lack of this function.

The demo here shows the difference.

fortunately, it's pretty simple to implement it in slint thanks to your works :)

ogoffart commented 10 months ago

I assume this is about having an animation when using the mouse wheel.

This shouldn't be too hard to do by using set_animated_value instead of set around https://github.com/slint-ui/slint/blob/a94148c12ced69fec92e3fdc99f068e4884f23c2/internal/core/items/flickable.rs#L316

std-microblock commented 10 months ago

I assume this is about having an animation when using the mouse wheel.

This shouldn't be too hard to do by using set_animated_value instead of set around https://github.com/slint-ui/slint/blob/a94148c12ced69fec92e3fdc99f068e4884f23c2/internal/core/items/flickable.rs#L316

nice! I don't know how to make properties animated on rust side so I failed to implement it after some investigations

ogoffart commented 9 months ago

I don't know how to make properties animated on rust side

Using the Property::set_animated_value https://docs.rs/i-slint-core/latest/i_slint_core/struct.Property.html#method.set_animated_value

std-microblock commented 9 months ago

I don't know how to make properties animated on rust side

Using the Property::set_animated_value https://docs.rs/i-slint-core/latest/i_slint_core/struct.Property.html#method.set_animated_value

Would you work on this? If not, I'll get the issue fixed and do pr when I have spare time.

hunger commented 9 months ago

We try to keep "good first issues" open for a bit to give contributors a chance to sink their teeth in:-)

Go ahead and give it a try.

std-microblock commented 3 months ago

image This is not working somehow, am I doing anything wrong? @ogoffart

tronical commented 2 months ago

How do you compute animated? Are you sure that it's true?

ogoffart commented 2 months ago

That looks alright, what is not working?

Maybe if this is called every frame, the animation is always restarted and never progress (just an idea, i don't know what the problem is)

std-microblock commented 2 months ago

How do you compute animated? Are you sure that it's true?

Yes

std-microblock commented 2 months ago

That looks alright, what is not working?

Maybe if this is called every frame, the animation is always restarted and never progress (just an idea, i don't know what the problem is)

I scroll, and nothing happens.

No, it's called only once each scroll.

Can you check what happened in my repo? I have no idea about this.

reproduce: cargo r --bin gallery, and check the standard list view