Attach drag handle events for Linker dialog
Add attachDragHandleIfNeeded() and call it when opening the dialog. The new helper binds a single mousedown listener on #model-linker-drag-handle (and a one-time document mouseup) to start dragging, set cursor state, and avoid attaching multiple times. It also skips drag behavior in fullscreen and safely no-ops if the handle element is missing.
This commit is contained in:
@@ -1785,10 +1785,33 @@ class LinkerManagerDialog extends ComfyDialog {
|
||||
if (fs === '1') this.setFullScreen(true);
|
||||
} catch (e) { }
|
||||
|
||||
// Attach drag handle event listener (only once)
|
||||
this.attachDragHandleIfNeeded();
|
||||
|
||||
// Use provided workflow or fetch from current graph
|
||||
await this.loadWorkflowData(workflow);
|
||||
}
|
||||
|
||||
// Attach drag handle event listeners
|
||||
attachDragHandleIfNeeded() {
|
||||
if (this._dragHandleAttached) return;
|
||||
|
||||
const handle = document.getElementById('model-linker-drag-handle');
|
||||
if (!handle) return;
|
||||
|
||||
const onMouseDown = (e) => {
|
||||
if (this.fullscreen) return; // no drag in fullscreen
|
||||
handle.style.cursor = 'grabbing';
|
||||
this.startDrag(e);
|
||||
};
|
||||
const onMouseUp = () => { handle.style.cursor = 'grab'; };
|
||||
|
||||
handle.addEventListener('mousedown', onMouseDown);
|
||||
document.addEventListener('mouseup', onMouseUp, { once: true });
|
||||
|
||||
this._dragHandleAttached = true;
|
||||
}
|
||||
|
||||
close() {
|
||||
this._hidePreview?.();
|
||||
this.backdrop.style.display = "none";
|
||||
|
||||
Reference in New Issue
Block a user