-
Notifications
You must be signed in to change notification settings - Fork 28.9k
MouseRegion enter/exit event can be triggered with button pressed #81148
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
// the pointer went down, rather than do hit detection each time we get | ||
// such an event. | ||
hitTestResult = _hitTests[event.pointer]; | ||
if (event.kind == PointerDeviceKind.mouse) { |
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 want to replace all the logic with this, but I can't fully evaluate the impact, so I limit the changes to mouse operations.
} else if (event.down) {
assert(_hitTests.containsKey(event.pointer));
hitTestResult = HitTestResult();
hitTest(hitTestResult, event.position);
_hitTests[event.pointer] = hitTestResult;
}
Thanks for the fix, although I don't think this is the best way to fix it. You changed to whom the Move events are dispatched to fix enter/exit. In the current event model, the hover/down/up/move events are independent from enter/exit. The root cause of this problem is how the target annotation for MouseTracker are calculated. My proposal is to change @override // from GestureBinding
void dispatchEvent(PointerEvent event, HitTestResult? hitTestResult) {
if (hitTestResult != null ||
event is PointerAddedEvent ||
event is PointerRemovedEvent) {
assert(event.position != null);
_mouseTracker!.updateWithEvent(event, () =>
(event.down || hitTestResult == null) ? renderView.hitTestMouseTrackers(event.position) : hitTestResult
);
}
super.dispatchEvent(event, hitTestResult);
} (Feel free to incorporate this change to your PR if you agree :) Although a little more comment to explain would be preferrable.) |
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
Just curious, what caused this PR to be reverted? |
Still investigating, we will try to reland this ASAP. |
…tton pressed (flutter#81148)" (flutter#81557)" This reverts commit d97f41c.
Fixes #69458
Fixes #80942
The doc says that event can be triggered with or without buttons pressed:
Code Sample