Suppress item activation after drag drop

This commit is contained in:
Mikei386
2026-06-23 12:11:06 +02:00
parent 50c685ee80
commit 9b12e0d150
5 changed files with 18 additions and 4 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
set -eu set -eu
PLUGIN="u-navigator" PLUGIN="u-navigator"
VERSION="2026.06.23.r024" VERSION="2026.06.23.r025"
PKG_DIR="packages" PKG_DIR="packages"
WORK_DIR=".plugin-build" WORK_DIR=".plugin-build"
PKG_NAME="${PLUGIN}-${VERSION}.tgz" PKG_NAME="${PLUGIN}-${VERSION}.tgz"
Binary file not shown.
Binary file not shown.
+15 -1
View File
@@ -13,6 +13,7 @@ const state = {
draggedEntry: null, draggedEntry: null,
pointerDrag: null, pointerDrag: null,
suppressClickPath: null, suppressClickPath: null,
suppressItemActivationUntil: 0,
debug: [], debug: [],
nextDebugId: 1, nextDebugId: 1,
jobs: new Map(), jobs: new Map(),
@@ -276,8 +277,12 @@ function renderExplorer(body, win) {
lockExplorerScroll(win, body); lockExplorerScroll(win, body);
startItemPointerDrag(event, win, entry); startItemPointerDrag(event, win, entry);
}); });
row.addEventListener('click', () => selectEntry(win, entry, body)); row.addEventListener('click', () => {
if (shouldSuppressItemActivation()) return;
selectEntry(win, entry, body);
});
row.addEventListener('dblclick', () => { row.addEventListener('dblclick', () => {
if (shouldSuppressItemActivation()) return;
if (entry.type === 'directory') { if (entry.type === 'directory') {
loadExplorer(win, entry.path); loadExplorer(win, entry.path);
} }
@@ -785,6 +790,14 @@ function selectEntry(win, entry, scrollBody = null) {
restoreExplorerScroll(win, scrollBody); restoreExplorerScroll(win, scrollBody);
} }
function shouldSuppressItemActivation() {
if (Date.now() <= state.suppressItemActivationUntil) {
recordDebug('item.activation.suppressed', { until: state.suppressItemActivationUntil });
return true;
}
return false;
}
function focusWindow(win) { function focusWindow(win) {
state.focusedId = win.id; state.focusedId = win.id;
win.zIndex = ++state.zIndex; win.zIndex = ++state.zIndex;
@@ -879,6 +892,7 @@ async function finishItemPointerDrag(event, move, up) {
event.preventDefault(); event.preventDefault();
state.suppressClickPath = drag.path; state.suppressClickPath = drag.path;
state.suppressItemActivationUntil = Date.now() + 450;
const target = findPointerDropTarget(event); const target = findPointerDropTarget(event);
recordDebug('pointer.finish', { recordDebug('pointer.finish', {
source: drag.path, source: drag.path,
+2 -2
View File
@@ -1,7 +1,7 @@
<!DOCTYPE PLUGIN [ <!DOCTYPE PLUGIN [
<!ENTITY name "u-navigator"> <!ENTITY name "u-navigator">
<!ENTITY author "Michael Roll"> <!ENTITY author "Michael Roll">
<!ENTITY version "2026.06.23.r024"> <!ENTITY version "2026.06.23.r025">
<!ENTITY package "&name;-&version;.tgz"> <!ENTITY package "&name;-&version;.tgz">
<!ENTITY pluginURL "https://git.casaderoll.de/michael/Unraid-Navigator/raw/branch/main/u-navigator.plg"> <!ENTITY pluginURL "https://git.casaderoll.de/michael/Unraid-Navigator/raw/branch/main/u-navigator.plg">
<!ENTITY support "https://git.casaderoll.de/michael/Unraid-Navigator"> <!ENTITY support "https://git.casaderoll.de/michael/Unraid-Navigator">
@@ -24,7 +24,7 @@
<FILE Name="/boot/config/plugins/&name;/&package;"> <FILE Name="/boot/config/plugins/&name;/&package;">
<URL>https://git.casaderoll.de/michael/Unraid-Navigator/raw/branch/main/packages/&package;</URL> <URL>https://git.casaderoll.de/michael/Unraid-Navigator/raw/branch/main/packages/&package;</URL>
<MD5>460c859d05c48638ba4c30e51e040b65</MD5> <MD5>e5c7cd67da544ca809a683f12093652e</MD5>
</FILE> </FILE>
<FILE Run="/bin/bash"> <FILE Run="/bin/bash">