[TS] Remove optional from widget y and type (#752)

- Fixes widget `type` marked as optional - it is required
- Fixes widget `y` marked as optional - now initialised to 0
This commit is contained in:
filtered
2025-03-12 02:46:10 +11:00
committed by GitHub
parent f6c605434b
commit a7f2ff16a9
4 changed files with 15 additions and 22 deletions

View File

@@ -2357,17 +2357,14 @@ export class LGraphCanvas implements ConnectionColorContext {
const x = pos[0] - node.pos[0]
const y = pos[1] - node.pos[1]
// @ts-expect-error https://github.com/Comfy-Org/litegraph.js/issues/616
const WidgetClass = WIDGET_TYPE_MAP[widget.type]
if (WidgetClass) {
const widgetInstance = toClass(WidgetClass, widget)
// @ts-expect-error https://github.com/Comfy-Org/litegraph.js/issues/616
pointer.onClick = () => widgetInstance.onClick({
e,
node,
canvas: this,
})
// @ts-expect-error https://github.com/Comfy-Org/litegraph.js/issues/616
pointer.onDrag = eMove => widgetInstance.onDrag?.({
e: eMove,
node,