Skip to content

Conversation

@ogoffart
Copy link
Member

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)

@ogoffart ogoffart requested a review from tronical September 16, 2022 08:06
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)
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
Copy link
Member

@tronical tronical left a 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
Copy link
Member

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?

Copy link
Member Author

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,
};
Copy link
Member

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?

Copy link
Member Author

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?

Copy link
Member

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.

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.

3 participants