feat(statusbar): honor $COORDS in the coordinate readout, click to cycle

The Coords pill always showed live absolute X,Y,Z, ignoring the drawing's
$COORDS (coords_mode) sysvar. Drive the readout from it:

- 0 static  — the last picked point; the readout freezes between picks.
- 1 live    — continuous absolute X,Y,Z (previous behavior, default).
- 2 polar   — distance<angle relative to the last point while a command is
              prompting for a point; absolute otherwise.

The cursor and last point are reported in the active UCS, matching the rest of
the readout. Clicking the pill cycles the mode 0→1→2→0 (CycleCoordsMode), marks
the tab dirty and echoes it; SETVAR COORDS still works. $COORDS round-trips per
drawing via acadrust's coords_mode.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-07-10 15:54:57 +03:00
1 parent 6bbd88153b
commit 71db52a0a4
4 files changed
+66 -8

No files matched your search

+12 -4
View File
@@ -1303,16 +1303,21 @@ impl OpenCADStudio {
// drawing coordinates (paper space carries no offset), then
// report it in the active UCS — the readout follows the
// user's coordinate system, not raw WCS (no-op without UCS).
let cursor_coord = {
let lc = tab.last_cursor_world;
let to_readout = |p: glam::Vec3| {
// The readout follows the active pane's UCS — model space
// or inside a floating viewport (no-op without a UCS).
if tab.editing_model_space() {
tab.ucs_xform().to_ucs(lc)
tab.ucs_xform().to_ucs(p)
} else {
lc
p
}
};
let cursor_coord = to_readout(tab.last_cursor_world);
// The last picked point (same UCS as the cursor) drives the
// static ($COORDS 0) and polar ($COORDS 2) readouts.
let last_coord = self.last_point.map(to_readout);
let coords_mode = tab.scene.document.header.coords_mode;
let picking = tab.active_cmd.is_some();
self.status_bar.view(
&self.snapper,
self.snap_popup_open,
@@ -1334,6 +1339,9 @@ impl OpenCADStudio {
scale_pill_enabled,
tab.scene.document.header.lineweight_display,
cursor_coord,
coords_mode,
last_coord,
picking,
self.clean_screen,
tab.scene.document.header.insertion_units,
self.units_popup_open,