diff --git a/flutter/lib/models/model.dart b/flutter/lib/models/model.dart index 3a4c9b987..bb5ce7325 100644 --- a/flutter/lib/models/model.dart +++ b/flutter/lib/models/model.dart @@ -691,11 +691,9 @@ class FFI { sendMouse('up', button); } - static void scroll(double y) { - var y2 = y.round(); - if (y2 == 0) return; + static void scroll(int y) { setByName('send_mouse', - json.encode(modify({'type': 'wheel', 'y': y2.toString()}))); + json.encode(modify({'type': 'wheel', 'y': y.toString()}))); } static void reconnect() { diff --git a/flutter/lib/pages/remote_page.dart b/flutter/lib/pages/remote_page.dart index ff8268ed0..e323f1ecb 100644 --- a/flutter/lib/pages/remote_page.dart +++ b/flutter/lib/pages/remote_page.dart @@ -32,6 +32,7 @@ class _RemotePageState extends State { double _bottom = 0; String _value = ''; double _scale = 1; + double _mouseScrollIntegral = 0; // mouse scroll speed controller var _more = true; var _fn = false; @@ -544,7 +545,14 @@ class _RemotePageState extends State { onThreeFingerVerticalDragUpdate: FFI.ffiModel.isPeerAndroid ? null : (d) { - FFI.scroll(d.delta.dy / 2); + _mouseScrollIntegral += d.delta.dy / 4; + if (_mouseScrollIntegral > 1) { + FFI.scroll(1); + _mouseScrollIntegral = 0; + } else if (_mouseScrollIntegral < -1) { + FFI.scroll(-1); + _mouseScrollIntegral = 0; + } }); }