mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Benjamin Lu <benceruleanlu@proton.me> Co-authored-by: github-actions <github-actions@github.com>
51 lines
1.2 KiB
TypeScript
51 lines
1.2 KiB
TypeScript
import type { IGalleriaWidget } from '../types/widgets'
|
|
import {
|
|
BaseWidget,
|
|
type DrawWidgetOptions,
|
|
type WidgetEventOptions
|
|
} from './BaseWidget'
|
|
|
|
/**
|
|
* Widget for displaying image galleries
|
|
* This is a widget that only has a Vue widgets implementation
|
|
*/
|
|
export class GalleriaWidget
|
|
extends BaseWidget<IGalleriaWidget>
|
|
implements IGalleriaWidget
|
|
{
|
|
override type = 'galleria' 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 = 'Galleria: 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
|
|
}
|
|
}
|