fix: scroll percent is auto reset after detecting displays change (#7845)

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2024-04-27 15:01:21 +08:00 committed by GitHub
parent a6632632fa
commit b403a7a25d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1017,6 +1017,8 @@ class FfiModel with ChangeNotifier {
} }
} }
} }
parent.target!.canvasModel
.tryUpdateScrollStyle(Duration(milliseconds: 300), null);
notifyListeners(); notifyListeners();
} }
@ -1412,10 +1414,20 @@ class CanvasModel with ChangeNotifier {
if (refreshMousePos) { if (refreshMousePos) {
parent.target?.inputModel.refreshMousePos(); parent.target?.inputModel.refreshMousePos();
} }
if (style == kRemoteViewStyleOriginal && tryUpdateScrollStyle(Duration.zero, style);
_scrollStyle == ScrollStyle.scrollbar) {
updateScrollPercent();
} }
tryUpdateScrollStyle(Duration duration, String? style) async {
if (_scrollStyle != ScrollStyle.scrollbar) return;
style ??= await bind.sessionGetViewStyle(sessionId: sessionId);
if (style != kRemoteViewStyleOriginal) {
return;
}
_resetScroll();
Future.delayed(duration, () async {
updateScrollPercent();
});
} }
updateScrollStyle() async { updateScrollStyle() async {