fix: respect drawing units in annotation scales

This commit is contained in:
gianlucafiore 2026-08-12 23:41:22 -03:00
commit e21d4954a3
3 changed files with 29 additions and 13 deletions

View file

@ -1144,13 +1144,16 @@ pub(super) fn on_open_file(&mut self) -> Task<Message> {
crate::scene::text::ttf_glyph::clear_fallback_cache();
}
// Current model-space annotation scale comes from the drawing's
// CANNOSCALEVALUE (paper/drawing factor); the multiplier we use
// for text/dim sizing is its inverse (1:50 -> 0.02 -> 50.0).
// CANNOSCALEVALUE (paper/drawing factor). Convert its inverse into
// drawing units as well: metric annotation sizes are paper millimetres
// and imperial annotation sizes are paper inches.
let cannoscale_value = self.tabs[i].scene.document.header.annotation_scale_value;
let unit_factor = self.tabs[i].scene.annotation_scale_unit_factor();
self.tabs[i].scene.annotation_scale = if cannoscale_value > 1e-9 {
(1.0 / cannoscale_value) as f32
((1.0 / cannoscale_value) / unit_factor) as f32
} else {
1.0
(1.0 / unit_factor) as f32
};
// Open-time breakdown so regressions are visible immediately.