Skip to content

Commit

Permalink
fix: mobile, don't reset canvas on metrics changed (rustdesk#10463)
Browse files Browse the repository at this point in the history
Signed-off-by: fufesou <[email protected]>
  • Loading branch information
fufesou authored Jan 15, 2025
1 parent b5d54de commit 222dbf1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions flutter/lib/models/model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1500,13 +1500,15 @@ class CanvasModel with ChangeNotifier {
return max(bottom - MediaQueryData.fromView(ui.window).padding.top, 0);
}

updateSize() => _size = getSize();

updateViewStyle({refreshMousePos = true, notify = true}) async {
final style = await bind.sessionGetViewStyle(sessionId: sessionId);
if (style == null) {
return;
}

_size = getSize();
updateSize();
final displayWidth = getDisplayWidth();
final displayHeight = getDisplayHeight();
final viewStyle = ViewStyle(
Expand Down Expand Up @@ -1543,7 +1545,7 @@ class CanvasModel with ChangeNotifier {
_resetCanvasOffset(int displayWidth, int displayHeight) {
_x = (size.width - displayWidth * _scale) / 2;
_y = (size.height - displayHeight * _scale) / 2;
if (isMobile && _lastViewStyle.style == kRemoteViewStyleOriginal) {
if (isMobile) {
_moveToCenterCursor();
}
}
Expand Down Expand Up @@ -1736,7 +1738,8 @@ class CanvasModel with ChangeNotifier {
_timerMobileFocusCanvasCursor?.cancel();
_timerMobileFocusCanvasCursor =
Timer(Duration(milliseconds: 100), () async {
await updateViewStyle(refreshMousePos: false, notify: false);
updateSize();
_resetCanvasOffset(getDisplayWidth(), getDisplayHeight());
notifyListeners();
});
}
Expand Down

0 comments on commit 222dbf1

Please sign in to comment.