Fix folder labels and drag target highlighting

This commit is contained in:
Mikei386
2026-07-14 18:14:53 +02:00
parent 82190887ee
commit 8ae0b96ce0
5 changed files with 8 additions and 35 deletions
-16
View File
@@ -2270,7 +2270,6 @@ function updateItemPointerDrag(event) {
event.preventDefault();
document.body.classList.add('u-nav-dragging');
markDraggingRows(drag.paths, true);
markDropCandidates(drag.paths, true);
updatePointerDropTarget(event);
}
@@ -2284,7 +2283,6 @@ async function finishItemPointerDrag(event, move, up) {
if (!drag) return;
markDraggingRows(drag.paths, false);
markDropCandidates(drag.paths, false);
state.pointerDrag = null;
if (!drag.active) {
@@ -2450,20 +2448,6 @@ function markDraggingRows(paths, dragging) {
}
}
function markDropCandidates(sourcePaths, active) {
const source = state.pointerDrag;
for (const row of workspace.querySelectorAll('.file-row[data-type="directory"]')) {
const path = row.dataset.path || '';
const valid = !sourcePaths.includes(path) && isValidPointerTargetPath(path, source);
row.classList.toggle('drop-candidate', active && valid);
}
for (const row of workspace.querySelectorAll('.tree-label[data-tree-open]')) {
const path = row.dataset.treeOpen || '';
const valid = !sourcePaths.includes(path) && isValidPointerTargetPath(path, source);
row.classList.toggle('drop-candidate', active && valid);
}
}
function isValidPointerTargetPath(path, drag = state.pointerDrag) {
if (!drag) return false;
return (drag.items || []).every((item) => {