From 8cabadd147f8562c9cb422440682c4e5c6c51905 Mon Sep 17 00:00:00 2001 From: huanld Date: Sat, 19 Sep 2026 13:55:48 +0700 Subject: [PATCH] fix(settings): keep isometric drafting session-only MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A persisted ISODRAFT flag turned every drawing's crosshair into the isoplane pair (one vertical, one diagonal arm) on every launch, with no visible control to switch it back off — F5 (ISOPLANE) only cycles the plane. Drop the flag when saving and ignore it when an old settings file still carries it; turning it on stays a per-session choice. --- src/app/settings.rs | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/app/settings.rs b/src/app/settings.rs index 2ddc3c39f..938189196 100644 --- a/src/app/settings.rs +++ b/src/app/settings.rs @@ -377,7 +377,12 @@ pub struct UserSettings { pub crosshair_color: Option<[u8; 3]>, /// Model-space lineweight preview scale as a percentage. pub lineweight_display_scale: i32, - /// Isometric drafting changes the grid and crosshair to the active axis pair. + /// Isometric drafting changes the grid and crosshair to the active axis + /// pair. Session-only: a persisted On turned every drawing's crosshair + /// into the isoplane pair (one vertical, one diagonal line) on every + /// launch, with no visible control to switch it back off. Turn it on for + /// a session with ISODRAFT; ISOPLANE keeps its persisted value. + #[serde(skip)] pub isometric_drafting: bool, pub iso_plane: IsoPlane, /// SNAPANG in degrees, applied in the active UCS plane. @@ -783,4 +788,27 @@ mod tests { assert!(!cfg.settings.pick_add, "the rest of the file must survive"); assert_eq!(cfg.settings.savetime_min, 42); } + + #[test] + fn isometric_drafting_never_persists_or_loads() { + // A persisted On used to bring the isoplane crosshair (vertical + + // diagonal arms) back on every launch for every drawing. The flag is + // session-only now: it is dropped when saving and ignored when a + // settings file still carries it. + let mut settings = UserSettings::default(); + settings.isometric_drafting = true; + let json = serde_json::to_string(&settings).expect("serialize settings"); + assert!( + !json.contains("isometric_drafting"), + "the saved settings must not carry the session-only flag: {json}" + ); + + let with_flag = r#"{ "isometric_drafting": true, "iso_plane": "Left" }"#; + let loaded: UserSettings = + serde_json::from_str(with_flag).expect("an old settings file must still parse"); + assert!( + !loaded.isometric_drafting, + "a persisted On must not turn isometric drafting back on" + ); + } }