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
chore: delay overlap dragtarget event
appflowy7be510fa22cd
diff --git a/frontend/app_flowy/packages/appflowy_board/lib/src/utils/log.dart b/frontend/app_flowy/packages/appflowy_board/lib/src/utils/log.dartindex d3b795f5f8..3d5baab30d 100644--- a/frontend/app_flowy/packages/appflowy_board/lib/src/utils/log.dart+++ b/frontend/app_flowy/packages/appflowy_board/lib/src/utils/log.dart@@ -28,7 +28,7 @@ class Log {static void trace(String? message) {if (enableLog) {- debugPrint('❗️[Trace] - ${DateTime.now().second}=> $message');+ // debugPrint('❗️[Trace] - ${DateTime.now().second}=> $message');}}}diff --git a/frontend/app_flowy/packages/appflowy_board/lib/src/widgets/board_data.dart b/frontend/app_flowy/packages/appflowy_board/lib/src/widgets/board_data.dartindex d0d102cba3..a08bba378f 100644--- a/frontend/app_flowy/packages/appflowy_board/lib/src/widgets/board_data.dart+++ b/frontend/app_flowy/packages/appflowy_board/lib/src/widgets/board_data.dart@@ -197,7 +197,7 @@ class AFBoardDataController extends ChangeNotifierassert(index != -1);if (index != -1) {if (index != newIndex) {- Log.debug(+ Log.trace('[$BoardPhantomController] update $columnId:$index to $columnId:$newIndex');final item = columnDataController.removeAt(index, notify: false);columnDataController.insert(newIndex, item, notify: false);diff --git a/frontend/app_flowy/packages/appflowy_board/lib/src/widgets/reorder_flex/drag_target_interceptor.dart b/frontend/app_flowy/packages/appflowy_board/lib/src/widgets/reorder_flex/drag_target_interceptor.dartindex 1438e396a4..d3a7e405e8 100644--- a/frontend/app_flowy/packages/appflowy_board/lib/src/widgets/reorder_flex/drag_target_interceptor.dart+++ b/frontend/app_flowy/packages/appflowy_board/lib/src/widgets/reorder_flex/drag_target_interceptor.dart@@ -55,6 +55,7 @@ class OverlappingDragTargetInterceptor extends DragTargetInterceptor {final String reorderFlexId;final List<String> acceptedReorderFlexId;final OverlapDragTargetDelegate delegate;+ Timer? _delayOperation;OverlappingDragTargetInterceptor({required this.delegate,@@ -77,12 +78,17 @@ class OverlappingDragTargetInterceptor extends DragTargetInterceptor {if (dragTargetId == dragTargetData.reorderFlexId) {delegate.cancel();} else {- final index = delegate.canMoveTo(dragTargetId);- Log.trace(- '[$OverlappingDragTargetInterceptor] move to $dragTargetId at $index');- if (index != -1) {- delegate.moveTo(dragTargetId, dragTargetData, index);- }+ /// The priority of the column interactions is high than the cross column.+ /// Workaround: delay 100 milliseconds to lower the cross column event priority.+ _delayOperation?.cancel();+ _delayOperation = Timer(const Duration(milliseconds: 100), () {+ final index = delegate.canMoveTo(dragTargetId);+ if (index != -1) {+ Log.trace(+ '[$OverlappingDragTargetInterceptor] move to $dragTargetId at $index');+ delegate.moveTo(dragTargetId, dragTargetData, index);+ }+ });}return true;diff --git a/frontend/app_flowy/packages/appflowy_board/lib/src/widgets/reorder_flex/reorder_flex.dart b/frontend/app_flowy/packages/appflowy_board/lib/src/widgets/reorder_flex/reorder_flex.dartindex 9916523782..f84fe8c991 100644--- a/frontend/app_flowy/packages/appflowy_board/lib/src/widgets/reorder_flex/reorder_flex.dart+++ b/frontend/app_flowy/packages/appflowy_board/lib/src/widgets/reorder_flex/reorder_flex.dart@@ -437,7 +437,7 @@ class ReorderFlexState extends State<ReorderFlex>/// The [willAccept] will be true if the dargTarget is the widget that gets/// dragged and it is dragged on top of the other dragTargets.///- Log.debug(+ Log.trace('[$ReorderDragTarget] ${widget.dataSource.identifier} on will accept, dragIndex:$dragIndex, dragTargetIndex:$dragTargetIndex, count: ${widget.dataSource.items.length}');bool willAccept =