fix: scrolling issue with single block node from bottom to top (#1148)
This commit is contained in:
parent
bcafa80b78
commit
85f0d81e50
2 changed files with 15 additions and 1 deletions
|
|
@ -33,7 +33,7 @@ class _ScrollServiceWidgetState extends State<ScrollServiceWidget>
|
|||
@override
|
||||
late ScrollController scrollController = ScrollController();
|
||||
|
||||
double offset = 0;
|
||||
Selection? lastSelection;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
|
@ -105,13 +105,25 @@ class _ScrollServiceWidgetState extends State<ScrollServiceWidget>
|
|||
case 'MobileSelectionDragMode.leftSelectionHandle':
|
||||
targetRect = selectionRects.first;
|
||||
direction = AxisDirection.up;
|
||||
break;
|
||||
case 'MobileSelectionDragMode.rightSelectionHandle':
|
||||
targetRect = selectionRects.last;
|
||||
direction = AxisDirection.down;
|
||||
break;
|
||||
default:
|
||||
targetRect = selectionRects.last;
|
||||
|
||||
/// sometimes moving up in a long single node may be not working
|
||||
/// so we need to special handle this case.
|
||||
final isInSingleNode = (lastSelection?.isSingle ?? false) &&
|
||||
lastSelection?.start.path == selection.start.path;
|
||||
if (selection.isForward && isInSingleNode) {
|
||||
targetRect = selectionRects.first;
|
||||
}
|
||||
}
|
||||
|
||||
lastSelection = selection;
|
||||
|
||||
final endTouchPoint = targetRect.centerRight;
|
||||
|
||||
if (PlatformExtension.isMobile) {
|
||||
|
|
|
|||
|
|
@ -300,6 +300,7 @@ class EdgeDraggingAutoScroller {
|
|||
scrollable.position.pixels + delta,
|
||||
);
|
||||
}
|
||||
break;
|
||||
case AxisDirection.right:
|
||||
case AxisDirection.down:
|
||||
if (proxyStart < viewportStart &&
|
||||
|
|
@ -323,6 +324,7 @@ class EdgeDraggingAutoScroller {
|
|||
scrollable.position.pixels + delta,
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
final double currentPixels = scrollable.position.pixels;
|
||||
|
|
|
|||
Loading…
Reference in a new issue