Skip to content

armgit / Filee

Public Imported from GitHub
0

Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.

Donut groups: a keyboard hold doesn't outlive the donut

SeoJCaliveb3036a7bd9a6
diff --git a/src/Filee.App/Controls/DonutMenu.cs b/src/Filee.App/Controls/DonutMenu.cs
index 5e103465..31259ef4 100644
--- a/src/Filee.App/Controls/DonutMenu.cs
+++ b/src/Filee.App/Controls/DonutMenu.cs
@@ -667,6 +667,9 @@ public sealed partial class DonutMenu : Control
_expanded = _shownExpanded = _subHover = -1;
ClearPending();
_expand = default;
+ // The window is reused: a keyboard hold from the last time it was open must not swallow the first moves now.
+ _keyboardHold = false;
+ _keyAnchor = _lastPointer = null;
InvalidateMeasure();
InvalidateVisual();
}
diff --git a/tests/Filee.App.Tests/DonutGroupTests.cs b/tests/Filee.App.Tests/DonutGroupTests.cs
index eff7f04d..05816e7e 100644
--- a/tests/Filee.App.Tests/DonutGroupTests.cs
+++ b/tests/Filee.App.Tests/DonutGroupTests.cs
@@ -368,6 +368,20 @@ public class DonutGroupTests
window.Close();
}
+ [AvaloniaFact]
+ public void Opened_again_the_donut_follows_the_mouse_at_once_after_the_keyboard_was_used_last_time()
+ {
+ var (donut, window) = Open();
+ var png = DonutGeometry.PointAt(Center(donut), donut.OuterRadius * 0.6, DonutGeometry.MidAngle(0, 4));
+ window.MouseMove(png);
+ donut.HandleKey(Key.Right); // the keyboard took over last time, with the mouse resting on PNG
+
+ donut.Items = [.. donut.Items!]; // opened again for new files: the window is reused
+ window.MouseMove(new Point(png.X + 2, png.Y)); // a small move near where the hold was
+ Assert.Equal(0, donut.ActiveIndex); // followed, not swallowed by last time's hold
+ window.Close();
+ }
+
[AvaloniaFact]
public void With_animations_off_a_group_opens_at_once()
{