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.

feat(home): add cross-platform double-click file selector to drop zone alongside drag-and-drop

gtxPrime4b5b06b735ec
diff --git a/src/Filee.App/Assets/i18n/en.json b/src/Filee.App/Assets/i18n/en.json
index c05ed709..9893a0b6 100644
--- a/src/Filee.App/Assets/i18n/en.json
+++ b/src/Filee.App/Assets/i18n/en.json
@@ -26,6 +26,7 @@
"home.title": "Home",
"home.drop_title": "Drop files here",
+ "home.drop_select": "Double-click to select files",
"home.drop_hint": "Or hold {0} while dragging files in Explorer. The donut toolbar opens at your cursor.",
"home.drop_hint_macos": "Or hold {0} while dragging files in Finder. The donut toolbar opens at your cursor.",
"home.drop_hint_linux": "Or hold {0} while dragging files in your file manager. The donut toolbar opens at your cursor.",
diff --git a/src/Filee.App/Assets/i18n/es.json b/src/Filee.App/Assets/i18n/es.json
index 589469c7..ffab1c59 100644
--- a/src/Filee.App/Assets/i18n/es.json
+++ b/src/Filee.App/Assets/i18n/es.json
@@ -23,6 +23,7 @@
"close.dont_ask": "No volver a preguntar",
"home.title": "Inicio",
"home.drop_title": "Suelta archivos aquí",
+ "home.drop_select": "Doble clic para seleccionar archivos",
"home.drop_hint": "O mantén {0} mientras arrastras archivos en el Explorador. El menú circular se abre donde esté el cursor.",
"home.drop_hint_macos": "O mantén {0} mientras arrastras archivos en Finder. El menú circular se abre donde esté el cursor.",
"home.drop_hint_linux": "O mantén {0} mientras arrastras archivos en tu gestor de archivos. El menú circular se abre donde esté el cursor.",
diff --git a/src/Filee.App/Assets/i18n/ko.json b/src/Filee.App/Assets/i18n/ko.json
index 160ca21e..fbbf7d29 100644
--- a/src/Filee.App/Assets/i18n/ko.json
+++ b/src/Filee.App/Assets/i18n/ko.json
@@ -26,6 +26,7 @@
"home.title": "홈",
"home.drop_title": "여기에 파일을 놓으세요",
+ "home.drop_select": "더블클릭하여 파일 선택",
"home.drop_hint": "또는 탐색기에서 {0} 키를 누른 채 파일을 드래그하면 커서 위치에 원형 툴바가 열려요.",
"home.drop_hint_macos": "또는 Finder에서 {0} 키를 누른 채 파일을 드래그하면 커서 위치에 원형 툴바가 열려요.",
"home.drop_hint_linux": "또는 파일 관리자에서 {0} 키를 누른 채 파일을 드래그하면 커서 위치에 원형 툴바가 열려요.",
diff --git a/src/Filee.App/Views/Pages/HomePage.axaml b/src/Filee.App/Views/Pages/HomePage.axaml
index 94c3fdcd..7c734c6d 100644
--- a/src/Filee.App/Views/Pages/HomePage.axaml
+++ b/src/Filee.App/Views/Pages/HomePage.axaml
@@ -54,8 +54,9 @@
</DockPanel>
</Border>
- <!-- Drop zone: files dropped here open the donut toolbar at the cursor. -->
+ <!-- Drop zone: files dropped here open the donut toolbar at the cursor. Double-click opens file selector. -->
<Border x:Name="DropZone" DragDrop.AllowDrop="True" MinHeight="220"
+ Cursor="Hand" ToolTip.Tip="{DynamicResource home.drop_select}"
Background="{DynamicResource AccentFaintBrush}" BorderBrush="{DynamicResource AccentSoftBrush}"
BorderThickness="2" CornerRadius="{DynamicResource SoftRadiusLarge}" Padding="24">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Spacing="10">
diff --git a/src/Filee.App/Views/Pages/HomePage.axaml.cs b/src/Filee.App/Views/Pages/HomePage.axaml.cs
index 8980e269..d285fed8 100644
--- a/src/Filee.App/Views/Pages/HomePage.axaml.cs
+++ b/src/Filee.App/Views/Pages/HomePage.axaml.cs
@@ -1,10 +1,10 @@
-// Drop zone: files dropped on the Home page open the donut (click mode) at the drop position, also pictures, links and
-// downloads dragged from a browser.
-
using Avalonia;
using Avalonia.Controls;
using Avalonia.Input;
+using Avalonia.Interactivity;
+using Avalonia.Platform.Storage;
using Filee.App.Services;
+using Filee.Core.Localization;
using Microsoft.Extensions.Logging;
namespace Filee.App.Views.Pages;
@@ -20,6 +20,7 @@ public partial class HomePage : UserControl
public HomePage()
{
InitializeComponent();
+ DropZone.DoubleTapped += OnDropZoneDoubleTapped;
DragDrop.AddDragEnterHandler(DropZone, (_, e) =>
{
DropZone.Classes.Add("over");
@@ -34,6 +35,36 @@ public partial class HomePage : UserControl
DragDrop.AddDropHandler(DropZone, OnDrop);
}
+ private async void OnDropZoneDoubleTapped(object? sender, TappedEventArgs e)
+ {
+ e.Handled = true;
+ if (TopLevel.GetTopLevel(this) is not { } top)
+ return;
+
+ var loc = AppHost.Get<ILocalizer>();
+ var files = await top.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
+ {
+ AllowMultiple = true,
+ Title = loc["home.drop_title"],
+ });
+
+ var paths = files
+ .Select(f => f.TryGetLocalPath())
+ .Where(p => !string.IsNullOrEmpty(p))
+ .Select(p => p!)
+ .ToList();
+
+ if (paths.Count == 0)
+ return;
+
+ var clickPos = e.GetPosition(this);
+ var targetPos = DropZone.Bounds.Contains(clickPos)
+ ? clickPos
+ : new Point(DropZone.Bounds.Width / 2, DropZone.Bounds.Height / 2);
+ var screenPoint = this.PointToScreen(targetPos);
+ AppHost.Get<RadialController>().ShowForFiles(screenPoint.X, screenPoint.Y, paths);
+ }
+
private void OnDrop(object? sender, DragEventArgs e)
{
DropZone.Classes.Remove("over");