From cfc7c06c6c9b62b2743820d3f6dcce12c9a90ef7 Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Fri, 7 Aug 2026 18:19:41 +0300 Subject: [PATCH] fix(scale): keep the standard scales when the first one is written MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A drawing that owns no annotation scales is shown the standard set, which `scale_list` substitutes whenever the drawing's own list is empty. The first thing to need a real scale object — an annotative dimension, a pick from the status bar, a viewport scale — wrote just the one it wanted. The drawing then had a list of its own, of exactly one entry, so the substitution stopped and every other scale disappeared from the picker. Bring the whole set in before writing that first scale. It is the set the drawing was already being shown, so nothing appears that was not on offer a moment earlier, and the drawing ends up owning its scales the way one that shipped with a list does. The seeding itself already existed for the scale manager, which stages it on open; it simply was not reachable from the path that writes a scale. Closes #666 Closes #683 Co-Authored-By: Claude Opus 5 --- src/scene/mod.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/scene/mod.rs b/src/scene/mod.rs index 2b000c875..dd84edd41 100644 --- a/src/scene/mod.rs +++ b/src/scene/mod.rs @@ -3625,6 +3625,10 @@ impl Scene { /// /// The scale manager calls this on open and stages the result, so the set /// is discarded again unless the user applies an edit. + /// + /// `scale_handle_ensuring` calls it for real, before it writes the first + /// scale a drawing has ever owned: one scale on its own would end the + /// substitution and leave the drawing holding a list of one. pub fn ensure_real_scale_list(&mut self) -> bool { if self.has_own_scales() { return false; @@ -3996,6 +4000,18 @@ impl Scene { if let Some(h) = self.scale_object_handle(name) { return Some(h); } + // A drawing that owns no scales is being shown the standard set that + // `scale_list` substitutes for an empty one. Writing only the scale + // asked for would give it a list of its own — of exactly one entry — + // and the substitution would stop, so every other scale would vanish + // from the picker the moment anything needed a real one. Bring the + // whole set in instead, which is what the drawing was already being + // shown. (#666, #683) + if self.ensure_real_scale_list() { + if let Some(h) = self.scale_object_handle(name) { + return Some(h); + } + } let fallback = self .default_scales() .iter()