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
Donut groups: in click mode only a donut with a group makes room for its ring
SeoJCalive986022868f09
diff --git a/src/Filee.App/Services/RadialController.cs b/src/Filee.App/Services/RadialController.csindex a0eef97d..e91c0fd7 100644--- a/src/Filee.App/Services/RadialController.cs+++ b/src/Filee.App/Services/RadialController.cs@@ -72,6 +72,7 @@ public sealed class RadialController(var window = EnsureWindow();_dropped = false;viewModel.Load(files, clickMode: true);+ viewModel.FitToThisDonut();window.DonutControl.AllowContextEdit = true;PlaceAndShow(window, x, y, activate: true);window.DonutControl.PlayOpenAnimation();diff --git a/src/Filee.App/ViewModels/RadialViewModel.cs b/src/Filee.App/ViewModels/RadialViewModel.csindex a59b3e08..4bd83616 100644--- a/src/Filee.App/ViewModels/RadialViewModel.cs+++ b/src/Filee.App/ViewModels/RadialViewModel.cs@@ -20,7 +20,12 @@ public sealed partial class RadialViewModel(UserDataStore store, ILocalizer loc,[ObservableProperty] private double _holeRatio = 0.42;[ObservableProperty] private double _sliceOpacity = 0.96;- /// <summary>Some donut has a group slice: the window keeps room for the ring it fans out.</summary>+ /// <summary>+ /// The window keeps room for the ring a group fans out. Dragging, the donut is placed before the files (and so+ /// the donut) are known: room when any donut has a group. In click mode only when this one does+ /// (<see cref="FitToThisDonut"/>), so other donuts stay as small, and as close to the cursor at a screen edge, as+ /// without groups.+ /// </summary>[ObservableProperty] private bool _reserveSubRing;/// <summary>@@ -78,6 +83,7 @@ public sealed partial class RadialViewModel(UserDataStore store, ILocalizer loc,Presets = [];_subPresets = [];ApplyAppearance();+ ReserveSubRing = store.Profiles.Any(profile => profile.PresetIds.Any(id => store.FindPreset(id)?.IsGroup == true));Items = [];CenterTitle = loc["donut.center_drag"];CenterSubtitle = null;@@ -167,9 +173,11 @@ public sealed partial class RadialViewModel(UserDataStore store, ILocalizer loc,CenterSubtitle = IsClickMode ? loc["donut.close_hint"] : null;}+ /// <summary>Click mode, before the window is placed: room for a group's ring only if this donut has a group.</summary>+ public void FitToThisDonut() => ReserveSubRing = Items.Any(item => item.IsGroup);+private void ApplyAppearance(){- ReserveSubRing = store.Profiles.Any(profile => profile.PresetIds.Any(id => store.FindPreset(id)?.IsGroup == true));OuterRadius = Math.Clamp(store.Settings.Donut.OuterRadius, 100, 240);HoleRatio = store.Settings.Donut.HoleRatio;SliceOpacity = store.Settings.Donut.Opacity;diff --git a/tests/Filee.App.Tests/DonutGroupTests.cs b/tests/Filee.App.Tests/DonutGroupTests.csindex ed4f3ade..eff7f04d 100644--- a/tests/Filee.App.Tests/DonutGroupTests.cs+++ b/tests/Filee.App.Tests/DonutGroupTests.cs@@ -223,6 +223,38 @@ public class DonutGroupTestswindow.Close();}+ [AvaloniaFact]+ public void Only_a_donut_with_a_group_keeps_room_for_its_ring_when_clicked_open()+ {+ TestServices.EnsureInitialized("en");+ var store = AppHost.Get<UserDataStore>();+ var images = store.Profiles.Single(p => p.Id == "images");+ var before = images.PresetIds.ToList();+ var group = new Preset { Id = "test-room-group", Name = "Formats", Kind = PresetKind.Group, SubPresetIds = ["to-png"] };+ try+ {+ store.Presets.Add(group);+ images.PresetIds.Add(group.Id);+ var vm = AppHost.Get<RadialViewModel>();++ vm.ResetForDrag(); // dragging: the files (and so the donut) aren't known yet+ Assert.True(vm.ReserveSubRing);++ vm.Load([@"C:\docs\a.pdf"], clickMode: true); // the PDF donut has no group+ vm.FitToThisDonut();+ Assert.False(vm.ReserveSubRing);+ vm.Load([@"C:\photos\a.jpg"], clickMode: true); // the image donut has+ vm.FitToThisDonut();+ Assert.True(vm.ReserveSubRing);+ }+ finally+ {+ images.PresetIds.Clear();+ images.PresetIds.AddRange(before);+ store.Presets.Remove(group);+ }+ }+[AvaloniaFact]public void A_group_left_without_presets_says_why_on_the_donut(){diff --git a/tests/Filee.App.Tests/RenderTests.cs b/tests/Filee.App.Tests/RenderTests.csindex 27887d9b..a03e3652 100644--- a/tests/Filee.App.Tests/RenderTests.cs+++ b/tests/Filee.App.Tests/RenderTests.cs@@ -361,6 +361,7 @@ public class RenderTestsimages.PresetIds.Add(group.Id);var vm = AppHost.Get<RadialViewModel>();vm.Load([@"C:\photos\a.jpg"], clickMode: true);+ vm.FitToThisDonut();Assert.True(vm.ReserveSubRing);var index = vm.Items.Count - 1;Assert.Equal(3, vm.Items[index].Children!.Count);