mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-09-19 19:01:05 +03:00
Synchronize edge-scroll cursor geometry after relayout
Refresh edge-scroll fractions from laid-out scroll positions and repaint when they differ from the values used by the frame. Preserve the repaint when a deferred settings refresh has already changed the model. Cover DPR changes, viewport clamping, detached scroll axes and restoration with the actual video and cursor widgets in Original and Custom modes. Verified 87 native Flutter cursor tests on each of macOS and Linux, plus 17 Chrome Web cursor tests.
This commit is contained in:
@@ -1173,6 +1173,7 @@ class _ImagePaintState extends State<ImagePaint> {
|
||||
child: child);
|
||||
});
|
||||
if (c.imageOverflow.isTrue && c.scrollStyle != ScrollStyle.scrollauto) {
|
||||
_syncEdgeScrollAfterLayout(c);
|
||||
final paintWidth = c.getDisplayWidth() * s;
|
||||
final paintHeight = c.getDisplayHeight() * s;
|
||||
final paintSize = Size(paintWidth, paintHeight);
|
||||
@@ -1217,6 +1218,16 @@ class _ImagePaintState extends State<ImagePaint> {
|
||||
}
|
||||
}
|
||||
|
||||
void _syncEdgeScrollAfterLayout(CanvasModel canvas) {
|
||||
if (canvas.scrollStyle != ScrollStyle.scrolledge) return;
|
||||
final renderedScroll = (canvas.scrollX, canvas.scrollY);
|
||||
// Relayout can clamp or detach scroll positions without a scroll event.
|
||||
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||
if (!mounted) return;
|
||||
canvas.updateEdgeScrollAfterLayout(renderedScroll);
|
||||
});
|
||||
}
|
||||
|
||||
Widget _buildScrollbarNonTextureRender(
|
||||
ImageModel m, Size imageSize, double s) {
|
||||
return CustomPaint(
|
||||
|
||||
@@ -2702,6 +2702,14 @@ class CanvasModel with ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void updateEdgeScrollAfterLayout((double, double) renderedScroll) {
|
||||
updateScrollPercent();
|
||||
// A delayed refresh may already have changed the model without repainting.
|
||||
if (renderedScroll != (_scrollX, _scrollY)) {
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
panX(double dx) {
|
||||
_x += dx;
|
||||
if (isMobile) {
|
||||
|
||||
Reference in New Issue
Block a user