Merge pull request #768 from gianlucafiore/fix/annotative-text-units
Fix annotative text scaling for drawing units
This commit is contained in:
commit
577530d2e8
3 changed files with 18 additions and 2 deletions
|
|
@ -705,7 +705,7 @@ impl super::OpenCADStudio {
|
|||
// it keeps the layout's shape, wrapping and alignment identical.
|
||||
mt.insertion_point = Vector3::new(0.0, 0.0, 0.0);
|
||||
let entity = EntityType::MText(mt.clone());
|
||||
let anno = self.tabs[i].scene.annotation_scale;
|
||||
let anno = 1.0;
|
||||
let bg = self.tabs[i].scene.bg_color;
|
||||
let wires: Vec<WireModel> = tessellate::tessellate(
|
||||
&self.tabs[i].scene.document,
|
||||
|
|
|
|||
|
|
@ -1147,6 +1147,10 @@ pub(super) fn on_open_file(&mut self) -> Task<Message> {
|
|||
// 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.
|
||||
// Current model-space annotation scale comes from the drawing's
|
||||
// CANNOSCALEVALUE (paper/drawing factor). Convert its paper unit into
|
||||
// the drawing's INSUNITS as well, so e.g. a metre drawing uses
|
||||
// 0.001 model units for 1 mm of paper at 1:1.
|
||||
let cannoscale_value = self.tabs[i].scene.document.header.annotation_scale_value;
|
||||
let unit_factor = self.tabs[i].scene.annotation_scale_unit_factor();
|
||||
|
||||
|
|
|
|||
|
|
@ -670,7 +670,19 @@ pub fn effective_annotation_scale_for(
|
|||
if !context_annotative && (text_like || !style_annotative) {
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
// Annotative TEXT/MTEXT store their paper text height as the base value.
|
||||
// `fallback` is the absolute paper-to-model multiplier for the active
|
||||
// annotation scale and already includes the drawing's INSUNITS conversion.
|
||||
//
|
||||
// Example for a metre drawing with 2 mm paper text:
|
||||
// 1:1 -> 2 * 0.001 = 0.002 m
|
||||
// 1:100 -> 2 * 0.100 = 0.200 m
|
||||
//
|
||||
// Using active/native here would only produce 1 / 100 and would lose the
|
||||
// millimetre-to-metre conversion entirely.
|
||||
if matches!(entity, EntityType::Text(_) | EntityType::MText(_)) {
|
||||
return fallback;
|
||||
}
|
||||
if matches!(
|
||||
entity,
|
||||
EntityType::Dimension(_)
|
||||
|
|
|
|||
Loading…
Reference in a new issue