Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2023-12-17 12:43:47 +08:00 committed by GitHub
parent c168b7e979
commit 004c2e069c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -181,6 +181,8 @@ class InputModel {
var _lastScale = 1.0;
bool _pointerMovedAfterEnter = false;
// mouse
final isPhysicalMouse = false.obs;
int _lastButtons = 0;
@ -441,6 +443,7 @@ class InputModel {
void enterOrLeave(bool enter) {
toReleaseKeys.release(handleRawKeyEvent);
_pointerMovedAfterEnter = false;
// Fix status
if (!enter) {
@ -778,6 +781,7 @@ class InputModel {
type = 'up';
break;
case _kMouseEventMove:
_pointerMovedAfterEnter = true;
isMove = true;
break;
default:
@ -785,6 +789,12 @@ class InputModel {
}
evt['type'] = type;
if (type == 'down' && !_pointerMovedAfterEnter) {
// Move mouse to the position of the down event first.
lastMousePos = ui.Offset(x, y);
refreshMousePos();
}
final pos = handlePointerDevicePos(
kPointerEventKindMouse,
x,