From cb4a5b88fc4ca5437269a235a246e0d7981ceb5b Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Thu, 27 Feb 2025 16:56:22 -0500 Subject: [PATCH] Remove magic 10% scale on numeric widget step (#2759) --- src/composables/widgets/useIntWidget.ts | 2 +- src/utils/mathUtil.ts | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/composables/widgets/useIntWidget.ts b/src/composables/widgets/useIntWidget.ts index e1abb4501..289a36071 100644 --- a/src/composables/widgets/useIntWidget.ts +++ b/src/composables/widgets/useIntWidget.ts @@ -40,7 +40,7 @@ export const useIntWidget = () => { inputName, val, function (this: INumericWidget, v: number) { - const s = (this.options.step ?? 1) / 10 + const s = this.options.step2 || 1 let sh = (this.options.min ?? 0) % s if (isNaN(sh)) { sh = 0 diff --git a/src/utils/mathUtil.ts b/src/utils/mathUtil.ts index 99302b14a..d29895278 100644 --- a/src/utils/mathUtil.ts +++ b/src/utils/mathUtil.ts @@ -27,6 +27,14 @@ export function getNumberDefaults( return { val: defaultVal, - config: { min, max, step: 10.0 * step, round, precision } + config: { + min, + max, + /** @deprecated Use step2 instead. The 10x value is a legacy implementation. */ + step: step * 10.0, + step2: step, + round, + precision + } } }