fix(scale): keep the standard scales when the first one is written

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 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 5 committed 2026-08-07 18:19:41 +03:00
1 parent 26b4f29a13
commit cfc7c06c6c
1 file changed
+16
+16
View File
@@ -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()