From e5ef85590317d950f80522153a4fed715e1a5c23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabio=20William=20Concei=C3=A7=C3=A3o?= Date: Mon, 9 Nov 2026 16:29:21 +0000 Subject: [PATCH] G5: size UI Frames so default 9-slice keeps round corners Button and Bar were shorter than 4x their corner radius, so the default guides cut through the curves on a vertical resize. --- crates/engine/src/cmd/symbollib.rs | 6 ++++-- crates/engine/src/tests/symbollib.rs | 18 ++++++++++++++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/crates/engine/src/cmd/symbollib.rs b/crates/engine/src/cmd/symbollib.rs index 67b2247d8..1e74eb456 100644 --- a/crates/engine/src/cmd/symbollib.rs +++ b/crates/engine/src/cmd/symbollib.rs @@ -199,10 +199,12 @@ fn basic_shapes() -> SymbolLibrary { /// UI Frames: panel, button and bar HUD chrome with default 9-slice guides (original art). fn ui_frames() -> SymbolLibrary { + // Heights keep default 9-slice (0.25) past each corner radius so a vertical resize + // stretches only the flat middle, not the curves. let frames = [ ("Panel", Rect::new(-48.0, -36.0, 48.0, 36.0), 10.0, "#2b3340", "#8aa0b8"), - ("Button", Rect::new(-36.0, -14.0, 36.0, 14.0), 8.0, "#3a6ea5", "#d7e6f5"), - ("Bar", Rect::new(-56.0, -10.0, 56.0, 10.0), 10.0, "#1f6b4a", "#b7e0c9"), + ("Button", Rect::new(-36.0, -18.0, 36.0, 18.0), 8.0, "#3a6ea5", "#d7e6f5"), + ("Bar", Rect::new(-56.0, -24.0, 56.0, 24.0), 10.0, "#1f6b4a", "#b7e0c9"), ]; let mut doc = Document::new(100.0, 100.0); for (name, rect, radius, fill_hex, edge_hex) in frames { diff --git a/crates/engine/src/tests/symbollib.rs b/crates/engine/src/tests/symbollib.rs index d7c135a6c..559c036c6 100644 --- a/crates/engine/src/tests/symbollib.rs +++ b/crates/engine/src/tests/symbollib.rs @@ -105,13 +105,23 @@ fn ui_frames_symbols_carry_default_nine_slice_when_added() { let lib = run(&mut s, "symbol.library", json!({"library": "ui-frames"})); let names: Vec<&str> = lib["symbols"].as_array().unwrap().iter().map(|x| x["name"].as_str().unwrap()).collect(); assert_eq!(names, ["Panel", "Button", "Bar"]); - let r = run(&mut s, "symbol.addFromLibrary", json!({"library": "ui-frames", "name": "Panel", "place": true, "x": 100.0, "y": 100.0})); - assert_eq!(r["added"], json!(["Panel"])); - assert!(r["placed"].as_u64().is_some()); + let mut placed = Vec::new(); + for (i, name) in names.iter().enumerate() { + let r = run( + &mut s, + "symbol.addFromLibrary", + json!({"library": "ui-frames", "name": name, "place": true, "x": 100.0 + 80.0 * i as f64, "y": 100.0}), + ); + assert_eq!(r["added"], json!([name])); + placed.push(r["placed"].as_u64().unwrap()); + } let d = doc(&s); + for name in &names { + assert!(d.symbol_nine_slice(name).is_some(), "{name} should have 9-slice guides"); + } assert_eq!(d.symbol_nine_slice("Panel"), Some(vectorcraft_doc::SymbolNineSlice::default())); assert!(matches!( - d.node(NodeId(r["placed"].as_u64().unwrap())).map(|n| &n.kind), + d.node(NodeId(placed[0])).map(|n| &n.kind), Some(NodeKind::SymbolInstance { symbol, .. }) if symbol == "Panel" )); }