VectorCraft: An open-source, vector art tool written by scratch in pure Rust
Info panel: scaled type shows its scaled size, as the Character panel does (part of #1882)
Marco Arnulfod0c302c1a3f0
diff --git a/crates/ui-egui/src/panels/info.rs b/crates/ui-egui/src/panels/info.rsindex a23678f9f..d2d79f135 100644--- a/crates/ui-egui/src/panels/info.rs+++ b/crates/ui-egui/src/panels/info.rs@@ -78,7 +78,10 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {&& let vectorcraft_doc::NodeKind::Text(tx) = &n.kind{widgets::divider(ui);- let st = tx.first_style();+ let raw = tx.first_style();+ // The size in document points, as the Character panel shows it (#1034); a collapsed+ // transform has none, so the stored size stands.+ let st = tx.effective_char_style(&raw).unwrap_or(raw);mono(ui, format!("{} {}", st.font_family, st.font_style));mono(ui,@@ -108,4 +111,18 @@ mod tests {assert_eq!(color_values(&Color::cmyk(0.1, 0.0, 0.0, 0.5))[3].1, "50%");assert_eq!(color_values(&Color::gray(0.25)).len(), 1);}++ /// #1882: scaled type shows its size in document points, as the Character panel does (#1034).+ #[test]+ fn scaled_type_shows_its_scaled_size() {+ use super::super::tests_appearance::{app_with_rect, frame_events, run};+ use serde_json::json;+ let mut app = app_with_rect();+ let id = run(&mut app, "text.create", json!({"x": 10, "y": 150, "text": "Hi", "size": 12}))["id"].clone();+ run(&mut app, "select.set", json!({ "ids": [id] }));+ run(&mut app, "object.scale", json!({"sx": 200}));+ let texts = frame_events(&egui::Context::default(), &mut app, vec![], show);+ let size = texts.iter().find(|(t, _)| t.starts_with("Size:")).map(|(t, _)| t.as_str());+ assert_eq!(size, Some("Size: 24 pt Tracking: 0"), "{texts:?}");+ }}