touch screen input

Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
dignow
2023-07-17 20:07:55 +08:00
parent 77eca6bcdc
commit c01c8d0afc
6 changed files with 354 additions and 153 deletions

View File

@@ -268,6 +268,14 @@ class InputModel {
sendMouse('up', button);
}
void tapDown(MouseButtons button) {
sendMouse('down', button);
}
void tapUp(MouseButtons button) {
sendMouse('up', button);
}
/// Send scroll event with scroll distance [y].
void scroll(int y) {
bind.sessionSendMouse(
@@ -429,7 +437,7 @@ class InputModel {
}
void onPointDownImage(PointerDownEvent e) {
debugPrint("onPointDownImage");
debugPrint("onPointDownImage ${e.kind}");
_stopFling = true;
if (e.kind != ui.PointerDeviceKind.mouse) {
if (isPhysicalMouse.value) {
@@ -469,6 +477,7 @@ class InputModel {
} else if (dy < 0) {
dy = 1;
}
debugPrint('REMOVE ME ================== onPointerSignalImage');
bind.sessionSendMouse(
sessionId: sessionId,
msg: '{"type": "wheel", "x": "$dx", "y": "$dy"}');

View File

@@ -1265,7 +1265,6 @@ class CursorModel with ChangeNotifier {
}
updatePan(double dx, double dy, bool touchMode) {
if (parent.target?.imageModel.image == null) return;
if (touchMode) {
final scale = parent.target?.canvasModel.scale ?? 1.0;
_x += dx / scale;
@@ -1274,6 +1273,7 @@ class CursorModel with ChangeNotifier {
notifyListeners();
return;
}
if (parent.target?.imageModel.image == null) return;
final scale = parent.target?.canvasModel.scale ?? 1.0;
dx /= scale;
dy /= scale;