Flat Pattern: show the whole flat size (#7495) (#7496)

* claim: #7495

* Flat Pattern: show the whole flat size (#7495)

Each side of the flat size and the thickness get their own row (Flat size X, Flat size Y,
Thickness), so the panel's width no longer cuts the value off after its first side.

* Flat Pattern: the flat size labels in Arabic, Hebrew and Vietnamese (#7495)
This commit is contained in:
Ahmad Khan
2026-10-28 13:25:09 +00:00
committed by GitHub
parent a5f472c23e
commit 6af571eb40
3 changed files with 62 additions and 8 deletions
@@ -0,0 +1,26 @@
{
"ar": {
"Flat size X": "الحجم المسطّح X",
"Flat size Y": "الحجم المسطّح Y"
},
"en": {
"Flat size X": "Flat size X",
"Flat size Y": "Flat size Y"
},
"he": {
"Flat size X": "מידות הפריסה X",
"Flat size Y": "מידות הפריסה Y"
},
"ja": {
"Flat size X": "展開サイズ X",
"Flat size Y": "展開サイズ Y"
},
"vi": {
"Flat size X": "Kích thước phôi phẳng X",
"Flat size Y": "Kích thước phôi phẳng Y"
},
"zh": {
"Flat size X": "平板尺寸 X",
"Flat size Y": "平板尺寸 Y"
}
}
+7 -8
View File
@@ -432,14 +432,13 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Sm, inputs: &mut [Sel
form_row(ui, "Body", |ui| {
ui.label(v["body"].as_str().unwrap_or(""));
});
form_row(ui, "Flat size", |ui| {
ui.label(format!(
"{} × {} × {}",
crate::prefs::show_mm(app, size[0].as_f64().unwrap_or(0.0), 1),
crate::prefs::show_mm(app, size[1].as_f64().unwrap_or(0.0), 1),
crate::prefs::show_mm(app, size[2].as_f64().unwrap_or(0.0), 1)
));
});
// One number per row, X and Y as in the DXF: on one row the panel's width cut the
// flat size off after its first side, and the second is the one people read most.
for (label, i) in [("Flat size X", 0), ("Flat size Y", 1), ("Thickness", 2)] {
form_row(ui, label, |ui| {
ui.label(crate::prefs::show_mm(app, size[i].as_f64().unwrap_or(0.0), 1));
});
}
let bends = v["bends"].as_array().cloned().unwrap_or_default();
form_row(ui, "Bends", |ui| {
ui.label(format!("{}", bends.len()));
+29
View File
@@ -194,6 +194,35 @@ fn shallow_pocket_overlay_labels_depth_without_drawing_a_through_void() {
}
}
/// The Flat Pattern panel shows each side of the flat size, and the thickness, whole: on one row
/// ("1250.00 mm × 1000.00 mm × 2.50 mm") the panel cut it off after the first side.
#[test]
fn flat_pattern_shows_each_side_of_the_flat_size_whole() {
for layout in ["docked", "floating"] {
let mut h = crate::scenario::Harness::new();
h.app.home.open = false;
h.call("ui.resize", json!({"width": 1600, "height": 1200}));
h.call("ui.set", json!({"layout": layout}));
h.app.run("sketch.create", json!({"plane": "XY", "name": "Base"})).unwrap();
h.app.run("sketch.rectangle.two_point", json!({"p0": [0, 0], "p1": [1250, 1000]})).unwrap();
h.app.run("sketch.finish", json!({})).unwrap();
h.app.run("sheet.flange", json!({"sketch": "Base"})).unwrap();
h.app.start("sheet.flat_pattern");
h.frames(4);
let output = h.ctx.run_ui(egui::RawInput { screen_rect: Some(h.ctx.content_rect()), focused: true, ..Default::default() }, |ui| {
h.app.logic(ui.ctx());
h.app.ui(ui);
});
let texts: Vec<_> = crate::test_support::text_shapes(&output).collect();
for (label, value) in [("Flat size X", "1250.00 mm"), ("Flat size Y", "1000.00 mm"), ("Thickness", "2.50 mm")] {
assert!(texts.iter().any(|t| t.galley.text() == label), "{layout}: no {label} row");
let shown = texts.iter().find(|t| t.galley.job.text == value).unwrap_or_else(|| panic!("{layout}: {label} {value} not painted"));
assert!(!shown.galley.elided, "{layout}: {label} is cut off");
}
assert!(!texts.iter().any(|t| t.galley.text().contains('×')), "{layout}: the sides are no longer run together");
}
}
#[test]
fn flat_pattern_islands_fit_before_the_actual_command_panel() {
for mode in [crate::shell::LayoutMode::Floating, crate::shell::LayoutMode::Docked] {