try fix android mouse mode

Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
dignow 2023-07-25 15:32:42 +08:00
parent 072338afae
commit 20cdb87e28
2 changed files with 15 additions and 4 deletions

View File

@ -1337,7 +1337,7 @@ class LastWindowPosition {
return LastWindowPosition(m["width"], m["height"], m["offsetWidth"], return LastWindowPosition(m["width"], m["height"], m["offsetWidth"],
m["offsetHeight"], m["isMaximized"]); m["offsetHeight"], m["isMaximized"]);
} catch (e) { } catch (e) {
debugPrintStack(label: e.toString()); debugPrintStack(label: 'Failed to load LastWindowPosition "$content" ${e.toString()}');
return null; return null;
} }
} }

View File

@ -93,8 +93,8 @@ class _RawTouchGestureDetectorRegionState
} }
if (handleTouch) { if (handleTouch) {
ffi.cursorModel.move(d.localPosition.dx, d.localPosition.dy); ffi.cursorModel.move(d.localPosition.dx, d.localPosition.dy);
inputModel.tapDown(MouseButtons.left);
} }
inputModel.tapDown(MouseButtons.left);
} }
onTapUp(TapUpDetails d) { onTapUp(TapUpDetails d) {
@ -107,6 +107,13 @@ class _RawTouchGestureDetectorRegionState
inputModel.tapUp(MouseButtons.left); inputModel.tapUp(MouseButtons.left);
} }
onTap() {
if (lastDeviceKind != PointerDeviceKind.touch) {
return;
}
inputModel.tap(MouseButtons.left);
}
onDoubleTapDown(TapDownDetails d) { onDoubleTapDown(TapDownDetails d) {
lastDeviceKind = d.kind; lastDeviceKind = d.kind;
if (lastDeviceKind != PointerDeviceKind.touch) { if (lastDeviceKind != PointerDeviceKind.touch) {
@ -115,6 +122,9 @@ class _RawTouchGestureDetectorRegionState
if (handleTouch) { if (handleTouch) {
ffi.cursorModel.move(d.localPosition.dx, d.localPosition.dy); ffi.cursorModel.move(d.localPosition.dx, d.localPosition.dy);
} }
if (!ffiModel.touchMode) {
inputModel.tapDown(MouseButtons.left);
}
} }
onDoubleTap() { onDoubleTap() {
@ -156,7 +166,7 @@ class _RawTouchGestureDetectorRegionState
if (lastDeviceKind != PointerDeviceKind.touch) { if (lastDeviceKind != PointerDeviceKind.touch) {
return; return;
} }
if (isDesktop || !handleTouch) { if (isDesktop || !ffiModel.touchMode) {
inputModel.tap(MouseButtons.right); inputModel.tap(MouseButtons.right);
} }
} }
@ -291,7 +301,8 @@ class _RawTouchGestureDetectorRegionState
() => TapGestureRecognizer(), (instance) { () => TapGestureRecognizer(), (instance) {
instance instance
..onTapDown = onTapDown ..onTapDown = onTapDown
..onTapUp = onTapUp; ..onTapUp = onTapUp
..onTap = onTap;
}), }),
DoubleTapGestureRecognizer: DoubleTapGestureRecognizer:
GestureRecognizerFactoryWithHandlers<DoubleTapGestureRecognizer>( GestureRecognizerFactoryWithHandlers<DoubleTapGestureRecognizer>(