mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-03 12:42:01 +00:00
[Refactor] Prefer param destructuring over manual (#756)
- Replaces manual runtime destructuring with built-in param destructuring - Standardises naming - Reorders deprecated code
This commit is contained in:
@@ -5,6 +5,13 @@ import type { IBaseWidget, IWidget, IWidgetOptions, TWidgetType, TWidgetValue }
|
||||
import { Point } from "@/interfaces"
|
||||
import { LiteGraph } from "@/litegraph"
|
||||
|
||||
export interface DrawWidgetOptions {
|
||||
y: number
|
||||
width: number
|
||||
show_text?: boolean
|
||||
margin?: number
|
||||
}
|
||||
|
||||
export abstract class BaseWidget implements IBaseWidget {
|
||||
linkedWidgets?: IWidget[]
|
||||
name: string
|
||||
@@ -72,12 +79,7 @@ export abstract class BaseWidget implements IBaseWidget {
|
||||
* @remarks Not naming this `draw` as `draw` conflicts with the `draw` method in
|
||||
* custom widgets.
|
||||
*/
|
||||
abstract drawWidget(ctx: CanvasRenderingContext2D, options: {
|
||||
y: number
|
||||
width: number
|
||||
show_text?: boolean
|
||||
margin?: number
|
||||
}): void
|
||||
abstract drawWidget(ctx: CanvasRenderingContext2D, options: DrawWidgetOptions): void
|
||||
|
||||
/**
|
||||
* Handles the click event for the widget
|
||||
|
||||
Reference in New Issue
Block a user