editor
editor copied to clipboard
feat: add imperial unit support for measurements in UI controls and t…
What does this PR do?
This PR fixes the bug where toggling the unit only affected the display of dimensions and not the input itself, specifically in the object editing panels. It also adds keyboard-based dimensional input to the Wall tool during drafting.
Fixes #308
Specific changes:
- Centralized Measurement Parsing: Added a new
measurements.tsutility to handle parsing and formatting between metric and imperial values (e.g., converting10'6"to meters). - Unit Respect in
SliderControl: UpdatedSliderControl(used in the Properties panels) to fetch the active unit state. It now properly formats values and parses imperial strings so that dimensions update correctly instead of silently reverting to metric. - Keyboard Dimension Input for Walls: Added direct drafting input to
WallTool. While drawing a wall, users can now type dimensions (e.g.,10') and pressEnterto snap the wall length in the current pointer direction exactly.
How to test
- Verify Unit Toggle in Properties Panel: Select an existing wall and change your global unit to Imperial. Select the wall again, and try changing the length via the properties panel using a string like
15'2". Ensure the wall length updates accurately. - Verify Wall Drafting Input: Select the Wall tool and click to start drawing. Before completing the wall, type
10'(a text input overlay should appear near your cursor). PressEnterand verify the wall is created at exactly10'length in the direction of the cursor. - Verify Escape/Cancel Flow: While typing a dimension in the Wall tool, press
Escapeto ensure it clears the text input without prematurely canceling the wall drawing itself.
Screenshots / screen recording
Checklist
- [x] I've tested this locally with
bun dev - [x] My code follows the existing code style (run
bun checkto verify) - [x] I've updated relevant documentation (if applicable)
- [x] This PR targets the
mainbranch