From a856e3695449c19810cdb8395c5879919d6af3d8 Mon Sep 17 00:00:00 2001 From: Stamina9 <1934687883@qq.com> Date: Wed, 11 Nov 2026 11:08:53 +0800 Subject: [PATCH] fix(donut): allow returning to a disabled front face Keep the front reachable after flipping to a usable back face, even when every front slice is disabled. Addresses #1374. --- src/Filee.App/ViewModels/RadialViewModel.cs | 3 ++- tests/Filee.App.Tests/DonutFlipTests.cs | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/Filee.App/ViewModels/RadialViewModel.cs b/src/Filee.App/ViewModels/RadialViewModel.cs index cb5043d53..eb8daa732 100644 --- a/src/Filee.App/ViewModels/RadialViewModel.cs +++ b/src/Filee.App/ViewModels/RadialViewModel.cs @@ -228,7 +228,8 @@ private void ShowFace(bool back, bool checkBack = true) Items = face.Items; } var other = back ? _front : checkBack ? BackFace() : _back; - CanFlip = other?.IsUsable == true; + // The front was already shown, even when every slice was disabled. Do not strand the user on the back face. + CanFlip = back ? _front.Items.Count > 0 : other?.IsUsable == true; var how = FlipKey is { } key ? KeyNames.Display(key) : ""; FlipHint = CanFlip && (FlipKey is not null || FlipWithWheel) ? loc.Format(back ? "donut.flip_to_front" : "donut.flip_to_back", how).Trim() diff --git a/tests/Filee.App.Tests/DonutFlipTests.cs b/tests/Filee.App.Tests/DonutFlipTests.cs index 324deabf7..76d2c25b5 100644 --- a/tests/Filee.App.Tests/DonutFlipTests.cs +++ b/tests/Filee.App.Tests/DonutFlipTests.cs @@ -735,6 +735,24 @@ public void A_donut_without_a_back_face_does_not_flip() => With(animations: true window.Close(); }); + [AvaloniaFact] + public void A_disabled_front_face_is_still_reachable_after_flipping_to_a_usable_back() => + With(animations: false, back: ["to-gif"], () => + { + Images.PresetIds = ["to-wav"]; + var (vm, window, donut) = OpenClickMode(); + try + { + Assert.All(vm.Items, item => Assert.False(item.IsEnabled)); + Assert.True(donut.Flip()); + Assert.True(vm.IsBackFace); + Assert.True(vm.CanFlip); + Assert.True(donut.Flip()); + Assert.False(vm.IsBackFace); + } + finally { window.Close(); } + }); + [AvaloniaFact] public void The_back_face_greys_out_what_cannot_convert_the_files_and_one_with_nothing_left_does_not_flip() {