Remove IMAGE widget cont. (#5355)

This commit is contained in:
Benjamin Lu
2025-09-04 13:45:49 -07:00
committed by GitHub
parent 8a10387fdf
commit c30f5a41a9
2 changed files with 0 additions and 54 deletions

View File

@@ -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<IImageWidget>
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
}
}

View File

@@ -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<TWidget extends IWidget | IBaseWidget>(
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':