mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: selection error in edge
This commit is contained in:
parent
215587a507
commit
6a27c490aa
@ -339,9 +339,10 @@ class _FlowySelectionState extends State<FlowySelection>
|
|||||||
start: isDownward ? start : end, end: isDownward ? end : start);
|
start: isDownward ? start : end, end: isDownward ? end : start);
|
||||||
debugPrint('[_onPanUpdate] isDownward = $isDownward, $selection');
|
debugPrint('[_onPanUpdate] isDownward = $isDownward, $selection');
|
||||||
editorState.updateCursorSelection(selection);
|
editorState.updateCursorSelection(selection);
|
||||||
|
|
||||||
|
_scrollUpOrDownIfNeeded(panEndOffset!, isDownward);
|
||||||
}
|
}
|
||||||
|
|
||||||
_scrollUpOrDownIfNeeded(panEndOffset!);
|
|
||||||
_showDebugLayerIfNeeded();
|
_showDebugLayerIfNeeded();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -466,7 +467,7 @@ class _FlowySelectionState extends State<FlowySelection>
|
|||||||
return NodeIterator(stateTree, startNode, endNode).toList();
|
return NodeIterator(stateTree, startNode, endNode).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _scrollUpOrDownIfNeeded(Offset offset) {
|
void _scrollUpOrDownIfNeeded(Offset offset, bool isDownward) {
|
||||||
final dy = editorState.service.scrollService?.dy;
|
final dy = editorState.service.scrollService?.dy;
|
||||||
if (dy == null) {
|
if (dy == null) {
|
||||||
assert(false, 'Dy could not be null');
|
assert(false, 'Dy could not be null');
|
||||||
@ -478,10 +479,10 @@ class _FlowySelectionState extends State<FlowySelection>
|
|||||||
/// TODO: It is necessary to calculate the relative speed
|
/// TODO: It is necessary to calculate the relative speed
|
||||||
/// according to the gap and move forward more gently.
|
/// according to the gap and move forward more gently.
|
||||||
final distance = 10.0;
|
final distance = 10.0;
|
||||||
if (offset.dy <= topLimit) {
|
if (offset.dy <= topLimit && !isDownward) {
|
||||||
// up
|
// up
|
||||||
editorState.service.scrollService?.scrollTo(dy - distance);
|
editorState.service.scrollService?.scrollTo(dy - distance);
|
||||||
} else if (offset.dy >= bottomLimit) {
|
} else if (offset.dy >= bottomLimit && isDownward) {
|
||||||
//down
|
//down
|
||||||
editorState.service.scrollService?.scrollTo(dy + distance);
|
editorState.service.scrollService?.scrollTo(dy + distance);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user