forked from 1b-agent/opencadstudio-upstream
fix(units): make the units selector reach what it names
The status-bar units button wrote INSUNITS, which nothing on screen reads. INSUNITS only tells the drawing how to scale content arriving from elsewhere, so picking a unit relabelled the drawing and changed nothing visible — the selector looked broken because the variable it moved was invisible. Point the button at LUNITS instead, the setting that decides how every coordinate and distance is written, and give the three questions the word "units" runs together a place each: - The button offers the five length formats, each shown beside a sample of itself, so Engineering and Architectural are told apart by sight. - UNITS / DDUNITS opens a real dialog: length and angle format and precision, the direction angle zero points, whether positive angles run clockwise, and the insertion unit. Its sample comes from the same formatters the drawing uses, so it cannot drift from the readout. - DWGUNITS converts. Model geometry, viewport framing, the header's length defaults and each dimension style's scale all move together in one undo step; paper space is left alone, since the sheet is still the same sheet. Locked layers are converted too — a half-converted drawing would be at two scales at once. The coordinate readout formatted at four decimal places whatever the drawing asked for; it now goes through the same format_length the properties panel uses. That made the angle formats reachable in turn, so degrees-minutes-seconds now carries the d/'/" marks that say which convention it is, and surveyor's units are written at all. Typed input is still plain decimal: a length the readout writes as 5'-6 1/2" cannot yet be typed back. ANGBASE and ANGDIR are stored but not yet applied to displayed directions. Closes #668 Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
1 parent
cfc7c06c6c
commit
523b85f42b
14 files changed
+937
-69
No files matched your search
@@ -408,6 +408,8 @@ pub(super) struct OpenCADStudio {
|
||||
last_layer_translation: Option<crate::modules::draw::layers::laytrans::Report>,
|
||||
/// The layer-translator dialog's working state while it is open.
|
||||
layer_translator: Option<crate::ui::window::layer_translator::State>,
|
||||
/// Working copy of the Drawing Units dialog; `None` while it is closed.
|
||||
drawing_units: Option<crate::ui::window::drawing_units::State>,
|
||||
/// PICKDRAG (#226): false (default) = press-drag lassoes; true =
|
||||
/// press-drag draws a rectangle marquee.
|
||||
pick_drag_rect: bool,
|
||||
@@ -1495,6 +1497,7 @@ pub enum ModalKind {
|
||||
Layers,
|
||||
LayerStateManager,
|
||||
LayerTranslator,
|
||||
DrawingUnits,
|
||||
LayerStateEditor,
|
||||
Plot,
|
||||
PrintAll,
|
||||
@@ -2196,6 +2199,14 @@ pub enum Message {
|
||||
CloseUnitsPopup,
|
||||
/// Set the drawing units (INSUNITS) for the active drawing.
|
||||
SetDrawingUnits(i16),
|
||||
/// LUNITS — how lengths are written, from the status-bar units button.
|
||||
SetLinearFormat(i16),
|
||||
/// Open the Drawing Units dialog, seeded from the active drawing.
|
||||
OpenDrawingUnits,
|
||||
/// One field of the Drawing Units dialog changed.
|
||||
DrawingUnitsField(crate::ui::window::drawing_units::Field),
|
||||
/// Drawing Units OK — write the working copy into the drawing.
|
||||
DrawingUnitsApply,
|
||||
/// Toggle the Isolate pill's action menu open/closed.
|
||||
ToggleIsolatePopup,
|
||||
/// Close the Isolate action menu.
|
||||
@@ -3009,6 +3020,7 @@ impl OpenCADStudio {
|
||||
select_remove_mode: false,
|
||||
last_layer_translation: None,
|
||||
layer_translator: None,
|
||||
drawing_units: None,
|
||||
pick_drag_rect: false,
|
||||
perf_hud: false,
|
||||
cycle_candidates: None,
|
||||
|
||||
Reference in new issue
Block a user