mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-26 09:44:06 +00:00
Fix widget.mouse callback does not receive pointerup events (#342)
* Provide pointerup events to widget.mouse callback * Fix regression in widget mouse cb pointerup events are now sent to mouse() callback regardless of CanvasPointer state.
This commit is contained in:
@@ -2656,7 +2656,11 @@ export class LGraphCanvas {
|
||||
)
|
||||
break
|
||||
default:
|
||||
if (widget.mouse) this.dirty_canvas = widget.mouse(e, [x, y], node)
|
||||
// Legacy custom widget callback
|
||||
if (widget.mouse) {
|
||||
const result = widget.mouse(e, [x, y], node)
|
||||
if (result != null) this.dirty_canvas = result
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
@@ -2666,7 +2670,17 @@ export class LGraphCanvas {
|
||||
node.graph._version++
|
||||
}
|
||||
|
||||
pointer.finally = () => this.node_widget = null
|
||||
// Clean up state var
|
||||
pointer.finally = () => {
|
||||
// Legacy custom widget callback
|
||||
if (widget.mouse) {
|
||||
const { eUp } = pointer
|
||||
const { canvasX, canvasY } = eUp
|
||||
widget.mouse(eUp, [canvasX - node[0], canvasY - node[1]], node)
|
||||
}
|
||||
|
||||
this.node_widget = null
|
||||
}
|
||||
|
||||
function setWidgetValue(
|
||||
canvas: LGraphCanvas,
|
||||
|
||||
Reference in New Issue
Block a user