mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-27 02:04:09 +00:00
Fix dragndrop subgraph widgets sticking to cursor (#8114)
Under some circumstances, subgraph widgets in the properties panel would have incorrect drag state - Debouncing list state would cause a race condition where a double click would initiate a drag on an element that no longer exists - This is solved by removing the debounce. - Right clicking on widgets would initiate a drag - Dragging now explicity requires a primary button click. Additionally, drag is now ended on `pointercancel`. This is purely for safety and may not actually be required. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-8114-Fix-dragndrop-subgraph-widgets-sticking-to-cursor-2ea6d73d365081f08515e8231bd87bdc) by [Unito](https://www.unito.io)
This commit is contained in:
@@ -72,6 +72,8 @@ export class DraggableList extends EventTarget {
|
||||
this.off.push(this.on(document, 'mouseup', this.dragEnd))
|
||||
// @ts-expect-error fixme ts strict error
|
||||
this.off.push(this.on(document, 'touchend', this.dragEnd))
|
||||
// @ts-expect-error fixme ts strict error
|
||||
this.off.push(this.on(document, 'pointercancel', this.dragEnd))
|
||||
}
|
||||
|
||||
getAllItems() {
|
||||
@@ -113,6 +115,8 @@ export class DraggableList extends EventTarget {
|
||||
|
||||
// @ts-expect-error fixme ts strict error
|
||||
dragStart(e) {
|
||||
if (e.button > 0) return
|
||||
|
||||
if (e.target.classList.contains(this.handleClass)) {
|
||||
this.draggableItem = e.target.closest(this.itemSelector)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user