Implement a legacy canvas widget for vue mode (#6011)

![updated-legacy-widget](https://github.com/user-attachments/assets/3f0a1623-9445-4059-acbb-086baec54980)

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-6011-Implement-a-legacy-canvas-widget-for-vue-mode-2896d73d36508127a5d1debcccb519a0)
by [Unito](https://www.unito.io)

---------

Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
AustinMroz
2025-10-16 18:50:19 -07:00
committed by GitHub
parent e48e11e434
commit 15b1b91b16
6 changed files with 125 additions and 21 deletions

View File

@@ -2801,7 +2801,7 @@ export class LGraphCanvas
// Widget
const widget = node.getWidgetOnPos(x, y)
if (widget) {
this.#processWidgetClick(e, node, widget)
this.processWidgetClick(e, node, widget)
this.node_widget = [node, widget]
} else {
// Node background
@@ -2981,13 +2981,12 @@ export class LGraphCanvas
this.dirty_canvas = true
}
#processWidgetClick(
processWidgetClick(
e: CanvasPointerEvent,
node: LGraphNode,
widget: IBaseWidget
widget: IBaseWidget,
pointer = this.pointer
) {
const { pointer } = this
// Custom widget - CanvasPointer
if (typeof widget.onPointerDown === 'function') {
const handled = widget.onPointerDown(pointer, node, this)