fix tooltip stacking on fast mouse movement
The delayed show callback fired even after the mouse had already exited, causing tooltips to stack. Track hover state with a bool and check it after the delay before showing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -22,6 +22,7 @@ class ClideTooltip extends StatefulWidget {
|
||||
|
||||
class _ClideTooltipState extends State<ClideTooltip> {
|
||||
OverlayEntry? _entry;
|
||||
bool _hovering = false;
|
||||
|
||||
void _show() {
|
||||
final overlay = Overlay.maybeOf(context);
|
||||
@@ -68,10 +69,14 @@ class _ClideTooltipState extends State<ClideTooltip> {
|
||||
tooltip: widget.message,
|
||||
child: MouseRegion(
|
||||
onEnter: (_) async {
|
||||
_hovering = true;
|
||||
await Future<void>.delayed(widget.showDelay);
|
||||
if (mounted) _show();
|
||||
if (mounted && _hovering) _show();
|
||||
},
|
||||
onExit: (_) {
|
||||
_hovering = false;
|
||||
_hide();
|
||||
},
|
||||
onExit: (_) => _hide(),
|
||||
child: widget.child,
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user