fix: scroll percent is auto reset after detecting displays change (#7845)
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
a6632632fa
commit
b403a7a25d
@ -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 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user