From 383b4de5399eb2bde0a548320d56a6a306bdbe5d Mon Sep 17 00:00:00 2001 From: Will Miao <13051207myq@gmail.com> Date: Fri, 22 Aug 2025 15:36:27 +0800 Subject: [PATCH] feat: Improve cursor handling during drag operations for better user experience --- web/comfyui/loras_widget.js | 1 - web/comfyui/loras_widget_components.js | 4 ++++ web/comfyui/loras_widget_events.js | 10 ++++++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/web/comfyui/loras_widget.js b/web/comfyui/loras_widget.js index fb6efaeb..cd8cca35 100644 --- a/web/comfyui/loras_widget.js +++ b/web/comfyui/loras_widget.js @@ -291,7 +291,6 @@ export function addLorasWidget(node, name, opts, callback) { whiteSpace: "nowrap", color: active ? "rgba(226, 232, 240, 0.9)" : "rgba(226, 232, 240, 0.6)", fontSize: "13px", - cursor: "pointer", userSelect: "none", WebkitUserSelect: "none", MozUserSelect: "none", diff --git a/web/comfyui/loras_widget_components.js b/web/comfyui/loras_widget_components.js index f1674a12..796ee061 100644 --- a/web/comfyui/loras_widget_components.js +++ b/web/comfyui/loras_widget_components.js @@ -115,6 +115,10 @@ export function createDragHandle() { handle.onmousedown = () => { handle.style.cursor = "grabbing"; }; + + handle.onmouseup = () => { + handle.style.cursor = "grab"; + }; return handle; } diff --git a/web/comfyui/loras_widget_events.js b/web/comfyui/loras_widget_events.js index e03fa08f..9108a173 100644 --- a/web/comfyui/loras_widget_events.js +++ b/web/comfyui/loras_widget_events.js @@ -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