mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-01 19:20:10 +00:00
[TS] Use strict mode in CanvasPointer, measure, and polyfills (#617)
- Adds runtime type guard - Adds ts-ignore that must be removed later * [ ] #578
This commit is contained in:
@@ -1727,6 +1727,7 @@ export class LGraphNode implements Positionable, IPinnable, IColorable {
|
||||
|
||||
addCustomWidget<T extends IWidget>(custom_widget: T): T {
|
||||
this.widgets ||= []
|
||||
// @ts-ignore https://github.com/Comfy-Org/litegraph.js/issues/616
|
||||
const WidgetClass = WIDGET_TYPE_MAP[custom_widget.type]
|
||||
const widget = WidgetClass ? new WidgetClass(custom_widget) as IWidget : custom_widget
|
||||
this.widgets.push(widget)
|
||||
@@ -3188,10 +3189,13 @@ export class LGraphNode implements Positionable, IPinnable, IColorable {
|
||||
if (w.disabled) ctx.globalAlpha *= 0.5
|
||||
const widget_width = w.width || width
|
||||
|
||||
const WidgetClass = WIDGET_TYPE_MAP[w.type]
|
||||
// @ts-ignore https://github.com/Comfy-Org/litegraph.js/issues/616
|
||||
const WidgetClass: typeof WIDGET_TYPE_MAP[string] = WIDGET_TYPE_MAP[w.type]
|
||||
if (WidgetClass) {
|
||||
// @ts-ignore https://github.com/Comfy-Org/litegraph.js/issues/616
|
||||
toClass(WidgetClass, w).drawWidget(ctx, { y, width: widget_width, show_text, margin })
|
||||
} else {
|
||||
// @ts-ignore https://github.com/Comfy-Org/litegraph.js/issues/616
|
||||
w.draw?.(ctx, this, widget_width, y, H)
|
||||
}
|
||||
ctx.globalAlpha = editorAlpha
|
||||
|
||||
Reference in New Issue
Block a user