properties: a text given a style takes its height, width and oblique (#503)

Changing a TEXT's style in the Properties panel only swapped the font, so
a style that differs in its fixed height, width factor or oblique angle
seemed to change nothing. The text now takes the style's fixed height
(when it sets one), width factor and oblique angle, and an MTEXT the
fixed height.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 5.5 committed 2026-10-15 01:35:34 +03:00
1 parent 368dd0d7a5
commit 601a97b4dd
1 file changed
+18
+18
View File
@@ -3461,6 +3461,11 @@ impl OpenCADStudio {
} else {
crate::command::WorkingPlane::default()
};
// A text taking a style takes what the style fixes: its height
// when the style sets one, its width factor and oblique angle.
let text_style = (field == "style")
.then(|| self.tabs[i].scene.document.text_styles.get(&value).cloned())
.flatten();
for &handle in &handles {
let mline_style =
self.tabs[i]
@@ -3488,6 +3493,19 @@ impl OpenCADStudio {
crate::scene::view::dispatch::apply_geom_prop_in_working_plane(
entity, field, &value, plane,
);
match (entity as &mut codec::EntityType, text_style.as_ref()) {
(codec::EntityType::Text(text), Some(style)) => {
if style.height > 0.0 {
text.height = style.height;
}
text.width_factor = style.width_factor;
text.oblique_angle = style.oblique_angle;
}
(codec::EntityType::MText(text), Some(style)) if style.height > 0.0 => {
text.height = style.height;
}
_ => {}
}
if matches!(field, "ml_justification" | "ml_scale") {
if let (codec::EntityType::MLine(mline), Some(style)) =
(entity, mline_style.as_ref())