-
Notifications
You must be signed in to change notification settings - Fork 770
Add a 100ms delay before forwarding the event in a Flickable #1652
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
Conversation
It was reported an annoying visual bug when flicking over a listview with item that has a special effect on pressed, that the items would show "pressed" for a brief instant. This patch add a small delay before sending the press event to the children. The FIXME in the test is not a regression. (This happens because we send Exited event to the children when flicking, despite the mouse is still in the area) Added a update_timers_and_animations from slint_mock_elapsed_time so we don't have to call update_timers_and_animations ourselves in the test anymore to fire the timers (it was previously only touching the animation property)
38645bd to
10fc887
Compare
The nodejs tests don't use the testing backend, as a result, calling `platform::update_timers_and_animations` would use the real time instead of the fake time. So call `maybe_activate_timers` with the fake time instead
tronical
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Does it still feel okay with nested flickables? I guess it’s fine when releasing (so clicking is all good).
| .apply_pin(flick) | ||
| .set_animated_value(final_pos.y, anim); | ||
| let millis = (crate::animations::current_tick() - pressed_time).as_millis(); | ||
| if dist.square_length() > (DISTANCE_THRESHOLD * DISTANCE_THRESHOLD) as f32 && millis > 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps this is also worth mentioning in the changelog?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This particular line is just not doing an animation if the mouse hasn't moved
| let event = match mouse_input_state.delayed.take() { | ||
| Some(e) => e.1, | ||
| None => return mouse_input_state, | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where the timer is dropped and stopped, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes.
You think it sould have a comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I think it’s fine. Just wanted to make sure I understand correctly.
It was reported an annoying visual bug when flicking over a listview with item that has a special effect on pressed, that the items would show "pressed" for a brief instant. This patch add a small delay before sending the press event to the children.
The FIXME in the test is not a regression. (This happens because we send Exited event to the children when flicking, despite the mouse is still in the area)
Added a update_timers_and_animations from slint_mock_elapsed_time so we don't have to call update_timers_and_animations ourselves in the test anymore to fire the timers (it was previously only touching the animation property)