Fix lodash import (#5269)

This commit is contained in:
Benjamin Lu
2025-08-30 18:00:56 -04:00
committed by GitHub
parent 3982f29fda
commit 08309595e0

View File

@@ -1,4 +1,4 @@
import _ from 'lodash' import { clamp } from 'es-toolkit/compat'
import type { LGraphNode } from '@/lib/litegraph/src/litegraph' import type { LGraphNode } from '@/lib/litegraph/src/litegraph'
import type { INumericWidget } from '@/lib/litegraph/src/types/widgets' import type { INumericWidget } from '@/lib/litegraph/src/types/widgets'
@@ -15,7 +15,7 @@ function onFloatValueChange(this: INumericWidget, v: number) {
const precision = const precision =
this.options.precision ?? Math.max(0, -Math.floor(Math.log10(round))) this.options.precision ?? Math.max(0, -Math.floor(Math.log10(round)))
const rounded = Math.round(v / round) * round const rounded = Math.round(v / round) * round
this.value = _.clamp( this.value = clamp(
Number(rounded.toFixed(precision)), Number(rounded.toFixed(precision)),
this.options.min ?? -Infinity, this.options.min ?? -Infinity,
this.options.max ?? Infinity this.options.max ?? Infinity