-
Notifications
You must be signed in to change notification settings - Fork 29.1k
Fix onExit calling when the mouse is removed. #33477
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
08ee775
to
d02c00b
Compare
@@ -408,6 +409,8 @@ class PointerEventConverter { | |||
timeStamp: timeStamp, | |||
kind: kind, | |||
device: datum.device, | |||
position: position, | |||
delta: delta, |
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.
If we already reported the delta on the hover event above, shouldn’t it be zero for the remove event then? My understanding is that it’s the delta of position since last event? (We should probably have a failing test for this situation...)
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.
Actually, I'm just going to remove the delta. It's not clear what it's a delta from, since there isn't another event of the same type to diff it from, and nobody's expecting a delta anyhow. And not specifying it will set it to zero in any case.
27af862
to
99fc11a
Compare
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.
LGTM
Looks like Cirrus is showing a legit failure though? |
Yeah, fixed it. |
Description
This PR solves two problems: currently, the
onExit
is called for a mouse pointer the moment the removal message is received, except that by the time it actually calls it, there is no_lastEvent
for it in the mouse tracker (it's already been removed), resulting in an event being passed to the onExit that contains nulls for the position. Also, removePointer events don't actually get created with a position, although they easily could be, so that even the the_lastEvent
in the mouse tracker were still populated, it would still give a null position and delta.This PR adds support for the
position
anddelta
in aPointerRemovedEvent
, and populates them. In addition, when a remove event is received, it doesn't actually remove the pointer until the mouse position check that gets scheduled actually happens.Tests
I added the following tests:
onExit
gets the proper position.mouse_tracking_test.dart
to verify that a position and delta is included.Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
). This will ensure a smooth and quick review process.///
).flutter analyze --flutter-repo
) does not report any problems on my PR.Breaking Change
Does your PR require Flutter developers to manually update their apps to accommodate your change?