From 0b8cccd8be93e83f54279ca61b0407d6c8c4d388 Mon Sep 17 00:00:00 2001 From: fufesou <13586388+fufesou@users.noreply.github.com> Date: Wed, 30 Oct 2024 19:00:07 +0800 Subject: [PATCH] fix: mobile view style, on conn (#9786) Signed-off-by: fufesou --- flutter/lib/models/model.dart | 8 +------- libs/hbb_common/src/config.rs | 3 +++ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/flutter/lib/models/model.dart b/flutter/lib/models/model.dart index bd844c3ca30..1e7baf6739d 100644 --- a/flutter/lib/models/model.dart +++ b/flutter/lib/models/model.dart @@ -1275,13 +1275,6 @@ class ImageModel with ChangeNotifier { if (isDesktop || isWebDesktop) { await parent.target?.canvasModel.updateViewStyle(); await parent.target?.canvasModel.updateScrollStyle(); - } else { - final size = MediaQueryData.fromWindow(ui.window).size; - final canvasWidth = size.width; - final canvasHeight = size.height; - final xscale = canvasWidth / image.width; - final yscale = canvasHeight / image.height; - parent.target?.canvasModel.scale = min(xscale, yscale); } if (parent.target != null) { await initializeCursorAndCanvas(parent.target!); @@ -1679,6 +1672,7 @@ class CanvasModel with ChangeNotifier { _x = 0; _y = 0; _scale = 1.0; + _lastViewStyle = ViewStyle.defaultViewStyle(); } updateScrollPercent() { diff --git a/libs/hbb_common/src/config.rs b/libs/hbb_common/src/config.rs index 73b330761a9..5807dafa5b4 100644 --- a/libs/hbb_common/src/config.rs +++ b/libs/hbb_common/src/config.rs @@ -1710,6 +1710,9 @@ impl UserDefaultConfig { pub fn get(&self, key: &str) -> String { match key { + #[cfg(any(target_os = "android", target_os = "ios"))] + keys::OPTION_VIEW_STYLE => self.get_string(key, "adaptive", vec!["original"]), + #[cfg(not(any(target_os = "android", target_os = "ios")))] keys::OPTION_VIEW_STYLE => self.get_string(key, "original", vec!["adaptive"]), keys::OPTION_SCROLL_STYLE => self.get_string(key, "scrollauto", vec!["scrollbar"]), keys::OPTION_IMAGE_QUALITY => {