[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:
filtered
2025-05-03 04:06:23 +10:00
committed by GitHub
parent b838a70ed2
commit 9dcc3bf39a
9 changed files with 53 additions and 61 deletions

View File

@@ -52,30 +52,29 @@ export class NumberWidget extends BaseSteppedWidget implements INumericWidget {
* @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()
this.drawArrowButtons(ctx, margin, y, width)