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.
C# audio-converteravaloniabatch-conversionconvertercsharpdocument-converterdocx-to-pdfdotnetdrag-and-dropfile-conversionfile-converterheic-converterhwphwpximage-converterlinuxmacospdf-convertervideo-converterwindows
Prototype: keep an open group while the pointer heads to its ring
SeoJCalived687b050aa62
diff --git a/src/Filee.App/Controls/DonutMenu.cs b/src/Filee.App/Controls/DonutMenu.csindex 1620eaad..50e4157c 100644--- a/src/Filee.App/Controls/DonutMenu.cs+++ b/src/Filee.App/Controls/DonutMenu.cs@@ -367,15 +367,23 @@ public sealed partial class DonutMenu : Controlif (IsEditMode && _hoverIndex >= 0 && _hoverIndex < Count &&Distance(p, EditButtonCenter(_hoverIndex)) <= 13)return new DonutHit(DonutHitKind.EditButton, _hoverIndex);+ var hit = DonutGeometry.HitTest(Center, p, InnerRadius, OuterRadius, Count, PopOut);if (ExpandedChildren is { } children){var (inner, outer) = SubRadii;- var sub = DonutGeometry.SubIndexAt(Center, p, inner, outer, DonutGeometry.MidAngle(_expanded, Count),- children.Count, DonutGeometry.SubSpan(DonutGeometry.Span(Count), children.Count));+ var parentMid = DonutGeometry.MidAngle(_expanded, Count);+ var subSpan = DonutGeometry.SubSpan(DonutGeometry.Span(Count), children.Count);+ var sub = DonutGeometry.SubIndexAt(Center, p, inner, outer, parentMid, children.Count, subSpan);if (sub >= 0)return new DonutHit(DonutHitKind.SubSegment, _expanded, sub);+ // On the way out to the ring's outer slices the pointer crosses the neighbours' outer edge: there it still+ // belongs to the group, or the ring would fold away (or switch) just before it is reached.+ if (hit.Kind == DonutHitKind.Segment && hit.Index != _expanded &&+ Distance(p, Center) > (InnerRadius + OuterRadius) / 2 &&+ DonutGeometry.SubIndexAt(Center, p, 0, double.MaxValue, parentMid, children.Count, subSpan) >= 0)+ return new DonutHit(DonutHitKind.Segment, _expanded);}- return DonutGeometry.HitTest(Center, p, InnerRadius, OuterRadius, Count, PopOut);+ return hit;}// ───────────────────────── Layout ─────────────────────────@@ -901,9 +909,19 @@ public sealed partial class DonutMenu : ControlDrawEditButton(context, EditButtonCenter(_hoverIndex));}+ /// <summary>+ /// Nearly transparent fill (alpha 1/255) under an open group's ring and the gap to it. Windows passes the mouse+ /// and drags through fully transparent pixels of a layered window, so without it the pointer "leaves" the donut+ /// in the gap and the ring folds away before it is reached.+ /// </summary>+ private static readonly IBrush HitBackdrop = new SolidColorBrush(Color.FromArgb(1, 0, 0, 0));+/// <summary>The ring an open group fans out, growing out of its slice.</summary>private void DrawSubRing(DrawingContext context, Point center, Typeface bold, Typeface regular){+ var reach = SubRadii.Outer + 8;+ context.DrawEllipse(HitBackdrop, null, center, reach, reach);+var group = _shownExpanded;var children = Items![group].Children!;var parentMid = DonutGeometry.MidAngle(group, Count);diff --git a/tests/Filee.App.Tests/RenderTests.cs b/tests/Filee.App.Tests/RenderTests.csindex ad07d955..e5235c25 100644--- a/tests/Filee.App.Tests/RenderTests.cs+++ b/tests/Filee.App.Tests/RenderTests.cs@@ -371,6 +371,11 @@ public class RenderTestsvar center = new Avalonia.Point(donut.Bounds.Width / 2, donut.Bounds.Height / 2);var onRing = DonutGeometry.PointAt(center, vm.OuterRadius + 7 + DonutMenu.SubRingSpace / 2 + 3, mid);Assert.Equal(new DonutHit(DonutHitKind.SubSegment, rotate, 1), donut.HitTest(onRing));+ // Heading out to the fan's edge across a neighbour's outer half keeps the group; its inner half doesn't.+ var neighbour = DonutGeometry.MidAngle(rotate, n) + DonutGeometry.Span(n) * 0.6;+ Assert.Equal(new DonutHit(DonutHitKind.Segment, rotate), donut.HitTest(DonutGeometry.PointAt(center, vm.OuterRadius - 8, neighbour)));+ Assert.Equal(new DonutHit(DonutHitKind.Segment, rotate + 1),+ donut.HitTest(DonutGeometry.PointAt(center, vm.OuterRadius * vm.HoleRatio + 6, neighbour)));Assert.Contains("90°", vm.CenterSubtitle);Save(window, $"donut-group-{language}.png");window.Close();