[Cleanup] Use WidgetOptions.step2 (#2926)

This commit is contained in:
Chenlei Hu
2025-03-08 19:10:33 -05:00
committed by GitHub
parent d8721760f1
commit 65573f106b

View File

@@ -222,11 +222,11 @@ export function addValueControlWidgets(
}
} else {
//number
let { min = 0, max = 1, step = 1 } = targetWidget.options
let { min = 0, max = 1, step2 = 1 } = targetWidget.options
// limit to something that javascript can handle
max = Math.min(1125899906842624, max)
min = Math.max(-1125899906842624, min)
let range = (max - min) / (step / 10)
let range = (max - min) / step2
//adjust values based on valueControl Behaviour
switch (v) {
@@ -234,15 +234,14 @@ export function addValueControlWidgets(
break
case 'increment':
// @ts-expect-error targetWidget.value can be number or string
targetWidget.value += step / 10
targetWidget.value += step2
break
case 'decrement':
// @ts-expect-error targetWidget.value can be number or string
targetWidget.value -= step / 10
targetWidget.value -= step2
break
case 'randomize':
targetWidget.value =
Math.floor(Math.random() * range) * (step / 10) + min
targetWidget.value = Math.floor(Math.random() * range) * step2 + min
break
default:
break