From c30f5a41a9c88469349b5d464fa575ff83dfdd3b Mon Sep 17 00:00:00 2001 From: Benjamin Lu Date: Thu, 4 Sep 2025 13:45:49 -0700 Subject: [PATCH] Remove IMAGE widget cont. (#5355) --- src/lib/litegraph/src/widgets/ImageWidget.ts | 50 -------------------- src/lib/litegraph/src/widgets/widgetMap.ts | 4 -- 2 files changed, 54 deletions(-) delete mode 100644 src/lib/litegraph/src/widgets/ImageWidget.ts diff --git a/src/lib/litegraph/src/widgets/ImageWidget.ts b/src/lib/litegraph/src/widgets/ImageWidget.ts deleted file mode 100644 index ff6cccc06..000000000 --- a/src/lib/litegraph/src/widgets/ImageWidget.ts +++ /dev/null @@ -1,50 +0,0 @@ -import type { IImageWidget } from '../types/widgets' -import { - BaseWidget, - type DrawWidgetOptions, - type WidgetEventOptions -} from './BaseWidget' - -/** - * Widget for displaying images - * This is a widget that only has a Vue widgets implementation - */ -export class ImageWidget - extends BaseWidget - implements IImageWidget -{ - override type = 'image' as const - - drawWidget(ctx: CanvasRenderingContext2D, options: DrawWidgetOptions): void { - const { width } = options - const { y, height } = this - - const { fillStyle, strokeStyle, textAlign, textBaseline, font } = ctx - - ctx.fillStyle = this.background_color - ctx.fillRect(15, y, width - 30, height) - - ctx.strokeStyle = this.outline_color - ctx.strokeRect(15, y, width - 30, height) - - ctx.fillStyle = this.text_color - ctx.font = '11px monospace' - ctx.textAlign = 'center' - ctx.textBaseline = 'middle' - - const text = 'Image: Vue-only' - ctx.fillText(text, width / 2, y + height / 2) - - Object.assign(ctx, { - fillStyle, - strokeStyle, - textAlign, - textBaseline, - font - }) - } - - onClick(_options: WidgetEventOptions): void { - // This is a widget that only has a Vue widgets implementation - } -} diff --git a/src/lib/litegraph/src/widgets/widgetMap.ts b/src/lib/litegraph/src/widgets/widgetMap.ts index e4e002270..3d1ac1ceb 100644 --- a/src/lib/litegraph/src/widgets/widgetMap.ts +++ b/src/lib/litegraph/src/widgets/widgetMap.ts @@ -34,7 +34,6 @@ import { ComboWidget } from './ComboWidget' import { FileUploadWidget } from './FileUploadWidget' import { GalleriaWidget } from './GalleriaWidget' import { ImageCompareWidget } from './ImageCompareWidget' -import { ImageWidget } from './ImageWidget' import { KnobWidget } from './KnobWidget' import { LegacyWidget } from './LegacyWidget' import { MarkdownWidget } from './MarkdownWidget' @@ -59,7 +58,6 @@ export type WidgetTypeMap = { fileupload: FileUploadWidget color: ColorWidget markdown: MarkdownWidget - image: ImageWidget treeselect: TreeSelectWidget multiselect: MultiSelectWidget chart: ChartWidget @@ -121,8 +119,6 @@ export function toConcreteWidget( return toClass(ColorWidget, narrowedWidget, node) case 'markdown': return toClass(MarkdownWidget, narrowedWidget, node) - case 'image': - return toClass(ImageWidget, narrowedWidget, node) case 'treeselect': return toClass(TreeSelectWidget, narrowedWidget, node) case 'multiselect':