mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-20 23:04:06 +00:00
Add unicorn lint rules - DOM built-in functions (#628)
- Prefer append(), remove(), replaceAll() - Wrap nested ternaries in parenthesis
This commit is contained in:
@@ -147,9 +147,9 @@ export class ComboWidget extends BaseWidget implements IComboWidget {
|
||||
// Determine if clicked on left/right arrows
|
||||
const delta = x < 40
|
||||
? -1
|
||||
: x > width - 40
|
||||
: (x > width - 40
|
||||
? 1
|
||||
: 0
|
||||
: 0)
|
||||
|
||||
// Get values
|
||||
let values = this.options.values
|
||||
|
||||
@@ -140,10 +140,10 @@ export class KnobWidget extends BaseWidget implements IKnobWidget {
|
||||
arc_center.y,
|
||||
)
|
||||
const gs = gradient_stops.split(";")
|
||||
gs.forEach((stop, index) => {
|
||||
for (const [index, stop] of gs.entries()) {
|
||||
console.log(stop)
|
||||
gradient.addColorStop(index, stop.trim())
|
||||
})
|
||||
}
|
||||
|
||||
ctx.strokeStyle = gradient
|
||||
const value_end_angle =
|
||||
@@ -240,9 +240,9 @@ export class KnobWidget extends BaseWidget implements IKnobWidget {
|
||||
|
||||
const step_with_shift_modifier = e.shiftKey
|
||||
? step_for.shift
|
||||
: use_y
|
||||
: (use_y
|
||||
? step_for.delta_y
|
||||
: step
|
||||
: step)
|
||||
// HACK: For some reason, the front-end multiplies step by 10, this brings it down to the advertised value
|
||||
// SEE: src/utils/mathUtil.ts@getNumberDefaults in front end
|
||||
const deltaValue = adjustment * step_with_shift_modifier / 10
|
||||
|
||||
@@ -105,9 +105,9 @@ export class NumberWidget extends BaseWidget implements INumericWidget {
|
||||
// Determine if clicked on left/right arrows
|
||||
const delta = x < 40
|
||||
? -1
|
||||
: x > width - 40
|
||||
: (x > width - 40
|
||||
? 1
|
||||
: 0
|
||||
: 0)
|
||||
|
||||
if (delta) {
|
||||
// Handle left/right arrow clicks
|
||||
@@ -131,7 +131,7 @@ export class NumberWidget extends BaseWidget implements INumericWidget {
|
||||
// Solve the equation if possible
|
||||
try {
|
||||
v = eval(v)
|
||||
} catch { }
|
||||
} catch {}
|
||||
}
|
||||
const newValue = Number(v)
|
||||
if (!isNaN(newValue)) {
|
||||
@@ -154,9 +154,9 @@ export class NumberWidget extends BaseWidget implements INumericWidget {
|
||||
const x = e.canvasX - node.pos[0]
|
||||
const delta = x < 40
|
||||
? -1
|
||||
: x > width - 40
|
||||
: (x > width - 40
|
||||
? 1
|
||||
: 0
|
||||
: 0)
|
||||
|
||||
if (delta && (x > -3 && x < width + 3)) return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user