mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-12 02:57:22 +00:00
desktop get mouse control by big distance
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
@@ -42,6 +42,7 @@ class InputModel {
|
||||
// mouse
|
||||
final isPhysicalMouse = false.obs;
|
||||
int _lastMouseDownButtons = 0;
|
||||
Offset last_mouse_pos = Offset.zero;
|
||||
|
||||
get id => parent.target?.id ?? "";
|
||||
|
||||
@@ -303,6 +304,22 @@ class InputModel {
|
||||
}
|
||||
|
||||
void handleMouse(Map<String, dynamic> evt) {
|
||||
double x = evt['x'];
|
||||
double y = max(0.0, evt['y']);
|
||||
final cursorModel = parent.target!.cursorModel;
|
||||
|
||||
if (!cursorModel.got_mouse_control) {
|
||||
bool self_get_control = (x - last_mouse_pos.dx).abs() > 12 ||
|
||||
(y - last_mouse_pos.dy).abs() > 12;
|
||||
if (self_get_control) {
|
||||
cursorModel.got_mouse_control = true;
|
||||
} else {
|
||||
last_mouse_pos = ui.Offset(x, y);
|
||||
return;
|
||||
}
|
||||
}
|
||||
last_mouse_pos = ui.Offset(x, y);
|
||||
|
||||
var type = '';
|
||||
var isMove = false;
|
||||
switch (evt['type']) {
|
||||
@@ -319,8 +336,6 @@ class InputModel {
|
||||
return;
|
||||
}
|
||||
evt['type'] = type;
|
||||
double x = evt['x'];
|
||||
double y = max(0.0, evt['y']);
|
||||
if (isDesktop) {
|
||||
y = y - stateGlobal.tabBarHeight;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user