Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
fix: selection error in edge
Lucas.Xu6a27c490aad0
diff --git a/frontend/app_flowy/packages/flowy_editor/lib/service/selection_service.dart b/frontend/app_flowy/packages/flowy_editor/lib/service/selection_service.dartindex 1786eca05f..9ae0082001 100644--- a/frontend/app_flowy/packages/flowy_editor/lib/service/selection_service.dart+++ b/frontend/app_flowy/packages/flowy_editor/lib/service/selection_service.dart@@ -339,9 +339,10 @@ class _FlowySelectionState extends State<FlowySelection>start: isDownward ? start : end, end: isDownward ? end : start);debugPrint('[_onPanUpdate] isDownward = $isDownward, $selection');editorState.updateCursorSelection(selection);++ _scrollUpOrDownIfNeeded(panEndOffset!, isDownward);}- _scrollUpOrDownIfNeeded(panEndOffset!);_showDebugLayerIfNeeded();}@@ -466,7 +467,7 @@ class _FlowySelectionState extends State<FlowySelection>return NodeIterator(stateTree, startNode, endNode).toList();}- void _scrollUpOrDownIfNeeded(Offset offset) {+ void _scrollUpOrDownIfNeeded(Offset offset, bool isDownward) {final dy = editorState.service.scrollService?.dy;if (dy == 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/// according to the gap and move forward more gently.final distance = 10.0;- if (offset.dy <= topLimit) {+ if (offset.dy <= topLimit && !isDownward) {// upeditorState.service.scrollService?.scrollTo(dy - distance);- } else if (offset.dy >= bottomLimit) {+ } else if (offset.dy >= bottomLimit && isDownward) {//downeditorState.service.scrollService?.scrollTo(dy + distance);}