feat: Improve cursor handling during drag operations for better user experience

This commit is contained in:
Will Miao
2025-08-22 15:36:27 +08:00
parent 1bf9326604
commit 383b4de539
3 changed files with 12 additions and 3 deletions

View File

@@ -304,6 +304,9 @@ export function initReorderDrag(dragHandle, loraName, widget, renderFunction) {
});
document.addEventListener('mouseup', (e) => {
// Always reset cursor regardless of isDragging state
document.body.style.cursor = '';
if (!isDragging || !draggedElement) return;
const targetIndex = getDropTargetIndex(container, e.clientY);
@@ -356,10 +359,13 @@ export function initReorderDrag(dragHandle, loraName, widget, renderFunction) {
dropIndicator = null;
}
// Reset cursor
document.body.style.cursor = '';
container = null;
});
// Also reset cursor when mouse leaves the document
document.addEventListener('mouseleave', () => {
document.body.style.cursor = '';
});
}
// Function to handle keyboard navigation