editor icon indicating copy to clipboard operation
editor copied to clipboard

feat: add imperial unit support for measurements in UI controls and t…

Open PRAVEEN7230 opened this issue 6 months ago • 0 comments

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.ts utility to handle parsing and formatting between metric and imperial values (e.g., converting 10'6" to meters).
  • Unit Respect in SliderControl: Updated SliderControl (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 press Enter to snap the wall length in the current pointer direction exactly.

How to test

  1. 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.
  2. 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). Press Enter and verify the wall is created at exactly 10' length in the direction of the cursor.
  3. Verify Escape/Cancel Flow: While typing a dimension in the Wall tool, press Escape to ensure it clears the text input without prematurely canceling the wall drawing itself.

Screenshots / screen recording

Screenshot 2026-05-15 at 11 09 34 PM Screenshot 2026-05-15 at 11 10 20 PM

Checklist

  • [x] I've tested this locally with bun dev
  • [x] My code follows the existing code style (run bun check to verify)
  • [x] I've updated relevant documentation (if applicable)
  • [x] This PR targets the main branch

PRAVEEN7230 avatar May 15 '26 17:05 PRAVEEN7230