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.

Don't show the donut for a drag gesture without files

KnifeLemonfbc679d4bdfe
diff --git a/src/Filee.App/Services/RadialController.cs b/src/Filee.App/Services/RadialController.cs
index e3f11a87..4c887ab6 100644
--- a/src/Filee.App/Services/RadialController.cs
+++ b/src/Filee.App/Services/RadialController.cs
@@ -1,8 +1,9 @@
// Opens, fills and closes the live donut toolbar.
//
// Drag mode (modifier + drag in Explorer):
-// gesture detected → empty ring appears at the cursor (not activated) → DragEnter brings the file list →
-// slices pop out → drop on a slice converts / drop in the hole or release elsewhere closes.
+// gesture detected → an invisible window waits at the cursor (not activated) → DragEnter brings the file list →
+// the donut pops out → drop on a slice converts / drop in the hole or release elsewhere closes. Without files
+// (text, a rubber-band selection) nothing ever shows.
// Click mode (keyboard shortcut, context menu, drop zone):
// files are known up front → donut appears activated → click a slice to convert, right-click to edit,
// Esc / click outside closes.
@@ -45,7 +46,11 @@ public sealed class RadialController(
public bool IsVisible => _visible;
- /// <summary>Drag gesture started at the given physical screen point.</summary>
+ /// <summary>
+ /// Drag gesture started at the given physical screen point. The window is placed under the cursor but stays
+ /// invisible until files are dragged into it (FilesEntered); a gesture without files (text, a rubber-band
+ /// selection, nothing at all) never shows anything and closes when the button is released.
+ /// </summary>
public void ShowForDrag(int x, int y)
{
ReleaseProgressToToast();
@@ -54,7 +59,6 @@ public sealed class RadialController(
viewModel.ResetForDrag();
window.DonutControl.AllowContextEdit = false;
PlaceAndShow(window, x, y, activate: false);
- window.DonutControl.PlayOpenAnimation();
}
/// <summary>Opens the donut for known files (click mode).</summary>
diff --git a/src/Filee.App/ViewModels/RadialViewModel.cs b/src/Filee.App/ViewModels/RadialViewModel.cs
index 2526a200..01cb7036 100644
--- a/src/Filee.App/ViewModels/RadialViewModel.cs
+++ b/src/Filee.App/ViewModels/RadialViewModel.cs
@@ -20,6 +20,18 @@ public sealed partial class RadialViewModel(UserDataStore store, ILocalizer loc,
[ObservableProperty] private double _holeRatio = 0.42;
[ObservableProperty] private double _sliceOpacity = 0.96;
+ /// <summary>
+ /// 0 while a drag gesture waits for files, 1 otherwise. The gesture starts before anyone knows what is being
+ /// dragged (a file, text, or nothing: Ctrl + a rubber-band selection), so the donut only appears when files enter.
+ /// </summary>
+ [ObservableProperty] private double _donutOpacity = 1;
+
+ /// <summary>
+ /// Background of the window while the donut is hidden: practically invisible, but not fully transparent, so
+ /// Windows still delivers the drag to this window and the files can arrive.
+ /// </summary>
+ [ObservableProperty] private string _hitBackground = "Transparent";
+
/// <summary>Files the donut will convert (empty while waiting for a drag to enter).</summary>
public IReadOnlyList<string> Files { get; private set; } = [];
@@ -41,6 +53,8 @@ public sealed partial class RadialViewModel(UserDataStore store, ILocalizer loc,
Items = [];
CenterTitle = loc["donut.center_drag"];
CenterSubtitle = null;
+ DonutOpacity = 0;
+ HitBackground = "#01000000";
}
/// <summary>Fills the donut for the given files.</summary>
@@ -48,6 +62,8 @@ public sealed partial class RadialViewModel(UserDataStore store, ILocalizer loc,
{
IsClickMode = clickMode;
Files = files;
+ DonutOpacity = 1;
+ HitBackground = "Transparent";
ApplyAppearance();
var profile = ProfileSelector.Select(store.Profiles, files);
diff --git a/src/Filee.App/Views/RadialWindow.axaml b/src/Filee.App/Views/RadialWindow.axaml
index 5b1d9d7c..6ddde95f 100644
--- a/src/Filee.App/Views/RadialWindow.axaml
+++ b/src/Filee.App/Views/RadialWindow.axaml
@@ -18,8 +18,9 @@
ShowActivated="False"
CanResize="False"
SizeToContent="WidthAndHeight">
- <Panel x:Name="Root" Background="Transparent" DragDrop.AllowDrop="True">
+ <Panel x:Name="Root" Background="{Binding HitBackground}" DragDrop.AllowDrop="True">
<c:DonutMenu x:Name="Donut"
+ Opacity="{Binding DonutOpacity}"
Items="{Binding Items}"
CenterTitle="{Binding CenterTitle}"
CenterSubtitle="{Binding CenterSubtitle}"
diff --git a/tests/Filee.App.Tests/RenderTests.cs b/tests/Filee.App.Tests/RenderTests.cs
index ed6d66cc..619435fe 100644
--- a/tests/Filee.App.Tests/RenderTests.cs
+++ b/tests/Filee.App.Tests/RenderTests.cs
@@ -125,7 +125,11 @@ public class RenderTests
Pump();
Assert.Empty(vm.Items);
+ // Nothing shows until files are dragged in (a Ctrl + drag without files must not open anything).
+ Assert.Equal(0, vm.DonutOpacity);
Save(window, "donut-drag-waiting.png");
+ vm.Load([@"C:\photos\a.jpg"], clickMode: false);
+ Assert.Equal(1, vm.DonutOpacity);
window.Close();
}