Fix folder labels and drag target highlighting
This commit is contained in:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user