diff --git a/flutter/lib/models/model.dart b/flutter/lib/models/model.dart index c37ae1046..c6f38534a 100644 --- a/flutter/lib/models/model.dart +++ b/flutter/lib/models/model.dart @@ -1240,8 +1240,8 @@ class FFI { return; } evt['type'] = type; - var x = evt['x']; - var y = max(0.0, (evt['y'] as double) - tabBarHeight); + double x = evt['x']; + double y = max(0.0, (evt['y'] as double) - tabBarHeight); if (isMove) { canvasModel.moveDesktopMouse(x, y); } @@ -1264,9 +1264,6 @@ class FFI { y -= canvasModel.y; } - if (!isMove && (x < 0 || x > d.width || y < 0 || y > d.height)) { - return; - } x /= canvasModel.scale; y /= canvasModel.scale; x += d.x; @@ -1275,6 +1272,9 @@ class FFI { x = 0; y = 0; } + // fix mouse out of bounds + x = min(max(0.0, x), d.width.toDouble()); + y = min(max(0.0, y), d.height.toDouble()); evt['x'] = '${x.round()}'; evt['y'] = '${y.round()}'; var buttons = '';