mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-03 12:42:01 +00:00
[Refactor] Remove redundant code (#1001)
Removes redundant code. After being refactored out of LGraphCanvas, the class methods were being passed their own properties as params.
This commit is contained in:
@@ -20,30 +20,29 @@ export class TextWidget extends BaseWidget implements IStringWidget {
|
||||
* @param options The options for drawing the widget
|
||||
*/
|
||||
override drawWidget(ctx: CanvasRenderingContext2D, {
|
||||
y,
|
||||
width,
|
||||
show_text = true,
|
||||
margin = BaseWidget.margin,
|
||||
showText = true,
|
||||
}: DrawWidgetOptions) {
|
||||
// Store original context attributes
|
||||
const originalTextAlign = ctx.textAlign
|
||||
const originalStrokeStyle = ctx.strokeStyle
|
||||
const originalFillStyle = ctx.fillStyle
|
||||
|
||||
const { height } = this
|
||||
const { height, y } = this
|
||||
const { margin } = BaseWidget
|
||||
|
||||
ctx.textAlign = "left"
|
||||
ctx.strokeStyle = this.outline_color
|
||||
ctx.fillStyle = this.background_color
|
||||
ctx.beginPath()
|
||||
|
||||
if (show_text)
|
||||
if (showText)
|
||||
ctx.roundRect(margin, y, width - margin * 2, height, [height * 0.5])
|
||||
else
|
||||
ctx.rect(margin, y, width - margin * 2, height)
|
||||
ctx.fill()
|
||||
|
||||
if (show_text) {
|
||||
if (showText) {
|
||||
if (!this.computedDisabled) ctx.stroke()
|
||||
ctx.save()
|
||||
ctx.beginPath()
|
||||
|
||||
Reference in New Issue
Block a user