mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-25 07:05:43 -03:00
feat: Improve cursor handling during drag operations for better user experience
This commit is contained in:
@@ -291,7 +291,6 @@ export function addLorasWidget(node, name, opts, callback) {
|
|||||||
whiteSpace: "nowrap",
|
whiteSpace: "nowrap",
|
||||||
color: active ? "rgba(226, 232, 240, 0.9)" : "rgba(226, 232, 240, 0.6)",
|
color: active ? "rgba(226, 232, 240, 0.9)" : "rgba(226, 232, 240, 0.6)",
|
||||||
fontSize: "13px",
|
fontSize: "13px",
|
||||||
cursor: "pointer",
|
|
||||||
userSelect: "none",
|
userSelect: "none",
|
||||||
WebkitUserSelect: "none",
|
WebkitUserSelect: "none",
|
||||||
MozUserSelect: "none",
|
MozUserSelect: "none",
|
||||||
|
|||||||
@@ -115,6 +115,10 @@ export function createDragHandle() {
|
|||||||
handle.onmousedown = () => {
|
handle.onmousedown = () => {
|
||||||
handle.style.cursor = "grabbing";
|
handle.style.cursor = "grabbing";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
handle.onmouseup = () => {
|
||||||
|
handle.style.cursor = "grab";
|
||||||
|
};
|
||||||
|
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -304,6 +304,9 @@ export function initReorderDrag(dragHandle, loraName, widget, renderFunction) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
document.addEventListener('mouseup', (e) => {
|
document.addEventListener('mouseup', (e) => {
|
||||||
|
// Always reset cursor regardless of isDragging state
|
||||||
|
document.body.style.cursor = '';
|
||||||
|
|
||||||
if (!isDragging || !draggedElement) return;
|
if (!isDragging || !draggedElement) return;
|
||||||
|
|
||||||
const targetIndex = getDropTargetIndex(container, e.clientY);
|
const targetIndex = getDropTargetIndex(container, e.clientY);
|
||||||
@@ -356,10 +359,13 @@ export function initReorderDrag(dragHandle, loraName, widget, renderFunction) {
|
|||||||
dropIndicator = null;
|
dropIndicator = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset cursor
|
|
||||||
document.body.style.cursor = '';
|
|
||||||
container = null;
|
container = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Also reset cursor when mouse leaves the document
|
||||||
|
document.addEventListener('mouseleave', () => {
|
||||||
|
document.body.style.cursor = '';
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function to handle keyboard navigation
|
// Function to handle keyboard navigation
|
||||||
|
|||||||
Reference in New Issue
Block a user