From bfc2296cec8a9804496ab983849a8fc6d8090a0d Mon Sep 17 00:00:00 2001 From: Benjamin Fan Date: Wed, 21 May 2025 20:14:22 -0700 Subject: [PATCH] fix(react,utils): Change imperial step to 1/16 in. --- .../components/Editor/components/menus/Input.mjs | 16 +++++++++++----- packages/utils/src/index.mjs | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/react/components/Editor/components/menus/Input.mjs b/packages/react/components/Editor/components/menus/Input.mjs index 25fd0dba999..1be1f5c8d2f 100644 --- a/packages/react/components/Editor/components/menus/Input.mjs +++ b/packages/react/components/Editor/components/menus/Input.mjs @@ -205,12 +205,18 @@ export const MenuMmInput = (props) => { /* * Set a default step that matches the unit. * - * Note that we could try to use something like 1.5875 for imperial to move in steps of 1/16 inches, - * but we round the mm values to two digits in the options, which would accumulate rounding errors. - * - * Because of this, we use 10ths of inches instead of 16ths of inches. + * Imperial: + * mm, inch, decimal digits precision needed: + * 1.27 mm, 0.1 in, 2 digits + * 3.175 mm, 1/8 in, 3 digits + * 1.5875 mm, 1/16 in, 4 digits + * 0.79375 mm, 1/32 in, 5 digits + * We previously rounded mm values to 2 digits in the options and used + * a 1.27 mm (1/10 in) step because precision didn't support 1/16 in + * or 1/32 in steps. + * We now round mm values to 4 digits and use a 1.5875 mm (1/16 in.) step. */ - const defaultStep = imperial ? 1.27 : 1 // mm + const defaultStep = imperial ? 1.5875 : 1 // mm return (