fix mobile mouse mode

Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
dignow
2023-07-25 22:09:42 +08:00
parent 20cdb87e28
commit 033645a7e0
2 changed files with 51 additions and 11 deletions

View File

@@ -103,8 +103,8 @@ class _RawTouchGestureDetectorRegionState
}
if (handleTouch) {
ffi.cursorModel.move(d.localPosition.dx, d.localPosition.dy);
inputModel.tapUp(MouseButtons.left);
}
inputModel.tapUp(MouseButtons.left);
}
onTap() {
@@ -122,9 +122,6 @@ class _RawTouchGestureDetectorRegionState
if (handleTouch) {
ffi.cursorModel.move(d.localPosition.dx, d.localPosition.dy);
}
if (!ffiModel.touchMode) {
inputModel.tapDown(MouseButtons.left);
}
}
onDoubleTap() {
@@ -146,6 +143,15 @@ class _RawTouchGestureDetectorRegionState
}
}
onLongPressUp() {
if (lastDeviceKind != PointerDeviceKind.touch) {
return;
}
if (handleTouch) {
inputModel.tapUp(MouseButtons.left);
}
}
// for mobiles
onLongPress() {
if (lastDeviceKind != PointerDeviceKind.touch) {
@@ -161,6 +167,14 @@ class _RawTouchGestureDetectorRegionState
inputModel.tap(MouseButtons.right);
}
onDoubleFinerTapDown(TapDownDetails d) {
lastDeviceKind = d.kind;
if (lastDeviceKind != PointerDeviceKind.touch) {
return;
}
// ignore for desktop and mobile
}
onDoubleFinerTap(TapDownDetails d) {
lastDeviceKind = d.kind;
if (lastDeviceKind != PointerDeviceKind.touch) {
@@ -231,12 +245,16 @@ class _RawTouchGestureDetectorRegionState
if (lastDeviceKind != PointerDeviceKind.touch) {
return;
}
if (handleTouch) {
inputModel.sendMouse('up', MouseButtons.left);
}
inputModel.sendMouse('up', MouseButtons.left);
}
// scale + pan event
onTwoFingerScaleStart(ScaleStartDetails d) {
if (lastDeviceKind != PointerDeviceKind.touch) {
return;
}
}
onTwoFingerScaleUpdate(ScaleUpdateDetails d) {
if (lastDeviceKind != PointerDeviceKind.touch) {
return;
@@ -316,6 +334,7 @@ class _RawTouchGestureDetectorRegionState
() => LongPressGestureRecognizer(), (instance) {
instance
..onLongPressDown = onLongPressDown
..onLongPressUp = onLongPressUp
..onLongPress = onLongPress;
}),
// Customized
@@ -330,7 +349,9 @@ class _RawTouchGestureDetectorRegionState
DoubleFinerTapGestureRecognizer:
GestureRecognizerFactoryWithHandlers<DoubleFinerTapGestureRecognizer>(
() => DoubleFinerTapGestureRecognizer(), (instance) {
instance.onDoubleFinerTap = onDoubleFinerTap;
instance
..onDoubleFinerTap = onDoubleFinerTap
..onDoubleFinerTapDown = onDoubleFinerTapDown;
}),
CustomTouchGestureRecognizer:
GestureRecognizerFactoryWithHandlers<CustomTouchGestureRecognizer>(
@@ -340,6 +361,7 @@ class _RawTouchGestureDetectorRegionState
instance
..onOneFingerPanUpdate = onOneFingerPanUpdate
..onOneFingerPanEnd = onOneFingerPanEnd
..onTwoFingerScaleStart = onTwoFingerScaleStart
..onTwoFingerScaleUpdate = onTwoFingerScaleUpdate
..onTwoFingerScaleEnd = onTwoFingerScaleEnd
..onThreeFingerVerticalDragUpdate = onThreeFingerVerticalDragUpdate;