From 110f6126e2e2823cfdae671504322100c2aca73e Mon Sep 17 00:00:00 2001 From: Arnab Chakraborty <11457760+Rocky43007@users.noreply.github.com> Date: Sun, 2 Feb 2025 02:59:28 -0500 Subject: [PATCH] Fix drag working in dev & prod --- Cargo.lock | Bin 343159 -> 343159 bytes apps/desktop/src-tauri/src/drag.rs | 2 +- apps/desktop/src/App.tsx | 4 +++- apps/desktop/src/commands.ts | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f0328c3282d4f25cfefd983553c15a94ee225fa3..826eb8c4c8f5e152092a6d53ba243caeab000409 100644 GIT binary patch delta 63 zcmezVL*)Apk%lddEXmXDRx!#>w@zW?+peF?7-q|8INfm_qwMy@3mA)HryIC2%C#H+ RV+3L*AZFff{Ex-O4geFc7s>zt delta 60 zcmezVL*)Apk%lddEXmXLyBKAsTc|6>GV OCLm_sZv2nM#SQ@Ll^7TR diff --git a/apps/desktop/src-tauri/src/drag.rs b/apps/desktop/src-tauri/src/drag.rs index 126b45fa3..6764cb57f 100644 --- a/apps/desktop/src-tauri/src/drag.rs +++ b/apps/desktop/src-tauri/src/drag.rs @@ -66,7 +66,7 @@ static TRACKING: AtomicBool = AtomicBool::new(false); /// * `window` - The Tauri window instance /// * `_state` - Current drag state (unused) /// * `files` - Vector of file paths to be dragged -/// * `icon_path` - Path to the preview icon for the drag operation +/// * `image` - Base64 encoded image to be used as drag icon /// * `on_event` - Channel for communicating drag operation events back to the frontend #[tauri::command(async)] #[specta::specta] diff --git a/apps/desktop/src/App.tsx b/apps/desktop/src/App.tsx index 9c0ec1bb4..0a438135f 100644 --- a/apps/desktop/src/App.tsx +++ b/apps/desktop/src/App.tsx @@ -142,9 +142,11 @@ function useDragAndDrop() { explorerStore.drag = null; }; + const image = !Transparent.includes('/@fs/') ? Transparent : Transparent.replace('/@fs', ''); + await invoke('start_drag', { files: validFiles, - image: Transparent, + image: image, onEvent: channel }); console.log('start_drag invoked successfully'); diff --git a/apps/desktop/src/commands.ts b/apps/desktop/src/commands.ts index 8516120a8..21e45b6bd 100644 --- a/apps/desktop/src/commands.ts +++ b/apps/desktop/src/commands.ts @@ -56,7 +56,7 @@ export const commands = { * * `window` - The Tauri window instance * * `_state` - Current drag state (unused) * * `files` - Vector of file paths to be dragged - * * `icon_path` - Path to the preview icon for the drag operation + * * `image` - Base64 encoded image to be used as drag icon * * `on_event` - Channel for communicating drag operation events back to the frontend */ async startDrag(