From 9e110bd09859114b796d451de4e70a15db573c8d Mon Sep 17 00:00:00 2001 From: "Lucas.Xu" Date: Tue, 29 Aug 2023 17:05:30 +0800 Subject: [PATCH] fix: hide toolbar when the selection area is invisible --- lib/src/editor/toolbar/desktop/floating_toolbar.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/src/editor/toolbar/desktop/floating_toolbar.dart b/lib/src/editor/toolbar/desktop/floating_toolbar.dart index 4f0b52cdc..beb067e3a 100644 --- a/lib/src/editor/toolbar/desktop/floating_toolbar.dart +++ b/lib/src/editor/toolbar/desktop/floating_toolbar.dart @@ -152,6 +152,10 @@ class _FloatingToolbarState extends State final rect = _findSuitableRect(rects); final (left, top, right) = calculateToolbarOffset(rect); + // if the selection is not visible, then don't show the toolbar. + if (top <= floatingToolbarHeight || (left == 0 && right == 0)) { + return; + } _toolbarContainer = OverlayEntry( builder: (context) { return Positioned(