mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-06-06 17:32:51 +08:00
fix mobile mouse mode
Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
parent
20cdb87e28
commit
033645a7e0
@ -184,6 +184,8 @@ class HoldTapMoveGestureRecognizer extends GestureRecognizer {
|
||||
_TapTracker? _firstTap;
|
||||
_TapTracker? _secondTap;
|
||||
|
||||
PointerDownEvent? _lastPointerDownEvent;
|
||||
|
||||
final Map<int, _TapTracker> _trackers = <int, _TapTracker>{};
|
||||
|
||||
@override
|
||||
@ -238,6 +240,7 @@ class HoldTapMoveGestureRecognizer extends GestureRecognizer {
|
||||
gestureSettings: gestureSettings,
|
||||
);
|
||||
_trackers[event.pointer] = tracker;
|
||||
_lastPointerDownEvent = event;
|
||||
tracker.startTrackingPointer(_handleEvent, event.transform);
|
||||
}
|
||||
|
||||
@ -248,7 +251,11 @@ class HoldTapMoveGestureRecognizer extends GestureRecognizer {
|
||||
_registerFirstTap(tracker);
|
||||
} else if (_secondTap != null) {
|
||||
if (event.pointer == _secondTap!.pointer) {
|
||||
if (onHoldDragEnd != null) onHoldDragEnd!(DragEndDetails());
|
||||
if (onHoldDragEnd != null) {
|
||||
onHoldDragEnd!(DragEndDetails());
|
||||
_secondTap = null;
|
||||
_isStart = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
_reject(tracker);
|
||||
@ -303,7 +310,11 @@ class HoldTapMoveGestureRecognizer extends GestureRecognizer {
|
||||
_secondTap?.entry.resolve(GestureDisposition.accepted);
|
||||
_isStart = true;
|
||||
// TODO start details
|
||||
if (onHoldDragStart != null) onHoldDragStart!(DragStartDetails());
|
||||
if (onHoldDragStart != null) {
|
||||
onHoldDragStart!(DragStartDetails(
|
||||
kind: _lastPointerDownEvent?.kind,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
void _reject(_TapTracker tracker) {
|
||||
@ -435,6 +446,8 @@ class DoubleFinerTapGestureRecognizer extends GestureRecognizer {
|
||||
Timer? _firstTapTimer;
|
||||
_TapTracker? _firstTap;
|
||||
|
||||
PointerDownEvent? _lastPointerDownEvent;
|
||||
|
||||
var _isStart = false;
|
||||
|
||||
final Set<int> _upTap = {};
|
||||
@ -476,6 +489,7 @@ class DoubleFinerTapGestureRecognizer extends GestureRecognizer {
|
||||
} else {
|
||||
// first tap
|
||||
_isStart = true;
|
||||
_lastPointerDownEvent = event;
|
||||
_startFirstTapDownTimer();
|
||||
}
|
||||
_trackTap(event);
|
||||
@ -591,7 +605,11 @@ class DoubleFinerTapGestureRecognizer extends GestureRecognizer {
|
||||
|
||||
void _resolve() {
|
||||
// TODO tap down details
|
||||
if (onDoubleFinerTap != null) onDoubleFinerTap!(TapDownDetails());
|
||||
if (onDoubleFinerTap != null) {
|
||||
onDoubleFinerTap!(TapDownDetails(
|
||||
kind: _lastPointerDownEvent?.kind,
|
||||
));
|
||||
}
|
||||
_trackers.forEach((key, value) {
|
||||
value.entry.resolve(GestureDisposition.accepted);
|
||||
});
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user