mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-04 07:00:23 +00:00
[CodeHealth] Apply modern standards to LGraphCanvas (#650)
- Prefer template string - Prefer explicit throw to undefined TypeError - Remove unnecessary `this` assignment
This commit is contained in:
@@ -186,12 +186,9 @@ export class KnobWidget extends BaseWidget implements IKnobWidget {
|
||||
if (show_text) {
|
||||
ctx.textAlign = "center"
|
||||
ctx.fillStyle = this.text_color
|
||||
const fixedValue = Number(this.value).toFixed(this.options.precision ?? 3)
|
||||
ctx.fillText(
|
||||
(this.label || this.name) +
|
||||
"\n" +
|
||||
Number(this.value).toFixed(
|
||||
this.options.precision != null ? this.options.precision : 3,
|
||||
),
|
||||
`${this.label || this.name}\n${fixedValue}`,
|
||||
widget_width * 0.5,
|
||||
y + effective_height * 0.5,
|
||||
)
|
||||
|
||||
@@ -77,12 +77,9 @@ export class SliderWidget extends BaseWidget implements ISliderWidget {
|
||||
if (show_text) {
|
||||
ctx.textAlign = "center"
|
||||
ctx.fillStyle = this.text_color
|
||||
const fixedValue = Number(this.value).toFixed(this.options.precision ?? 3)
|
||||
ctx.fillText(
|
||||
(this.label || this.name) +
|
||||
" " +
|
||||
Number(this.value).toFixed(
|
||||
this.options.precision != null ? this.options.precision : 3,
|
||||
),
|
||||
`${this.label || this.name} ${fixedValue}`,
|
||||
widget_width * 0.5,
|
||||
y + H * 0.7,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user