mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
Fix, cursor position, scall origin, scrollbar (#6612)
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
@@ -1205,6 +1205,9 @@ class CanvasModel with ChangeNotifier {
|
||||
ScrollStyle _scrollStyle = ScrollStyle.scrollauto;
|
||||
ViewStyle _lastViewStyle = ViewStyle.defaultViewStyle();
|
||||
|
||||
final ScrollController _horizontal = ScrollController();
|
||||
final ScrollController _vertical = ScrollController();
|
||||
|
||||
final _imageOverflow = false.obs;
|
||||
|
||||
WeakReference<FFI> parent;
|
||||
@@ -1229,6 +1232,8 @@ class CanvasModel with ChangeNotifier {
|
||||
_scrollY = y;
|
||||
}
|
||||
|
||||
ScrollController get scrollHorizontal => _horizontal;
|
||||
ScrollController get scrollVertical => _vertical;
|
||||
double get scrollX => _scrollX;
|
||||
double get scrollY => _scrollY;
|
||||
|
||||
@@ -1289,6 +1294,7 @@ class CanvasModel with ChangeNotifier {
|
||||
if (refreshMousePos) {
|
||||
parent.target?.inputModel.refreshMousePos();
|
||||
}
|
||||
updateScrollPercent();
|
||||
}
|
||||
|
||||
updateScrollStyle() async {
|
||||
@@ -1424,6 +1430,22 @@ class CanvasModel with ChangeNotifier {
|
||||
_scale = 1.0;
|
||||
if (notify) notifyListeners();
|
||||
}
|
||||
|
||||
updateScrollPercent() {
|
||||
final percentX = _horizontal.hasClients
|
||||
? _horizontal.position.extentBefore /
|
||||
(_horizontal.position.extentBefore +
|
||||
_horizontal.position.extentInside +
|
||||
_horizontal.position.extentAfter)
|
||||
: 0.0;
|
||||
final percentY = _vertical.hasClients
|
||||
? _vertical.position.extentBefore /
|
||||
(_vertical.position.extentBefore +
|
||||
_vertical.position.extentInside +
|
||||
_vertical.position.extentAfter)
|
||||
: 0.0;
|
||||
setScrollPercent(percentX, percentY);
|
||||
}
|
||||
}
|
||||
|
||||
// data for cursor
|
||||
|
||||
Reference in New Issue
Block a user