opt gesture -

opt:Auto recover cursor;Expand scale limit.
fix:twoFinger mistake
This commit is contained in:
csf
2022-07-02 21:24:49 +08:00
parent b32d643f8c
commit 4a0e047c03
3 changed files with 82 additions and 50 deletions

View File

@@ -481,6 +481,7 @@ class _RemotePageState extends State<RemotePage> {
/// DoubleFiner -> right click
/// HoldDrag -> left drag
Offset _cacheLongPressPosition = Offset(0, 0);
Widget getBodyForMobileWithGesture() {
final touchMode = FFI.ffiModel.touchMode;
return getMixinGestureDetector(
@@ -504,10 +505,14 @@ class _RemotePageState extends State<RemotePage> {
},
onLongPressDown: (d) {
if (touchMode) {
FFI.cursorModel.move(d.localPosition.dx, d.localPosition.dy);
_cacheLongPressPosition = d.localPosition;
}
},
onLongPress: () {
if (touchMode) {
FFI.cursorModel
.move(_cacheLongPressPosition.dx, _cacheLongPressPosition.dy);
}
FFI.tap(MouseButtons.right);
},
onDoubleFinerTap: (d) {
@@ -534,6 +539,15 @@ class _RemotePageState extends State<RemotePage> {
if (touchMode) {
FFI.cursorModel.move(d.localPosition.dx, d.localPosition.dy);
FFI.sendMouse('down', MouseButtons.left);
} else {
final cursorX = FFI.cursorModel.x;
final cursorY = FFI.cursorModel.y;
final visible =
FFI.cursorModel.getVisibleRect().inflate(1); // extend edges
final size = MediaQueryData.fromWindow(ui.window).size;
if (!visible.contains(Offset(cursorX, cursorY))) {
FFI.cursorModel.move(size.width / 2, size.height / 2);
}
}
},
onOneFingerPanUpdate: (d) {