From 7573793d6cdd856189558d14354306f9baea0430 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Tue, 3 Aug 2021 00:35:25 +0800 Subject: [PATCH] onLongPress -> right click --- flutter_hbb/lib/remote_page.dart | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/flutter_hbb/lib/remote_page.dart b/flutter_hbb/lib/remote_page.dart index 66613ad76..ab79968f8 100644 --- a/flutter_hbb/lib/remote_page.dart +++ b/flutter_hbb/lib/remote_page.dart @@ -28,7 +28,6 @@ class _RemotePageState extends State { String _value = ''; double _xOffset = 0; double _yOffset = 0; - double _xOffset0 = 0; double _yOffset0 = 0; double _scale = 1; bool _mouseTools = false; @@ -258,24 +257,17 @@ class _RemotePageState extends State { : null, body: FlutterEasyLoading( child: GestureDetector( + onLongPress: () { + if (_drag || _scroll) return; + FFI.tap(true); + }, onTap: () { if (_drag || _scroll) return; FFI.tap(_right); }, - onLongPressStart: (_) { - if (_drag) { - // case: to show password on windows - FFI.sendMouse('down', 'left'); - } - }, - onLongPressEnd: (_) { - if (_drag) { - FFI.sendMouse('up', 'left'); - } - }, onScaleStart: (details) { _scale = 1; - _xOffset = _xOffset0 = details.focalPoint.dx; + _xOffset = details.focalPoint.dx; _yOffset = _yOffset0 = details.focalPoint.dy; if (_drag) { FFI.sendMouse('down', 'left'); @@ -304,6 +296,11 @@ class _RemotePageState extends State { onScaleEnd: (details) { if (_drag) { FFI.sendMouse('up', 'left'); + setState(() { + _drag = false; + _scroll = false; + _right = false; + }); } else if (_scroll) { var dy = (_yOffset - _yOffset0) / 10; if (dy.abs() > 0.1) {