Construction Geometries, a Sketch Palette row that hides construction geometry (#804)
A Sketch Palette toggle (sketch.options show_construction) that hides construction geometry from drawing and picking; saved with the sketch's view options under format 17. Co-authored-by: William Dunn <[email protected]>
This commit is contained in:
1 parent
9184994721
commit
d302aa1a00
15 files changed
+224
-10
No files matched your search
@@ -258,6 +258,20 @@ mod tests {
|
||||
assert_eq!(Locale::for_language("de").label("Points"), Locale::for_language("de").text("ui.points"));
|
||||
}
|
||||
|
||||
/// The Construction Geometries row passes its English text, like the other seven text
|
||||
/// rows. "Construction" on its own is already the line-type entry `ui.construction`, so
|
||||
/// the row's two-word text must reach its own entry rather than that one.
|
||||
#[test]
|
||||
fn the_construction_geometries_row_reaches_its_own_entry_not_the_line_type() {
|
||||
let rows = [("de", "Konstruktionsgeometrien"), ("ja", "構築ジオメトリ"), ("ko", "구성 형상")];
|
||||
for (lang, want) in rows {
|
||||
let locale = Locale::for_language(lang);
|
||||
assert_eq!(locale.label("Construction Geometries"), want, "{lang}");
|
||||
assert_ne!(locale.label("Construction Geometries"), locale.text("ui.construction"), "{lang}");
|
||||
}
|
||||
assert_eq!(Locale::for_language("en").label("Construction Geometries"), "Construction Geometries");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn templates_allow_reordering_and_literal_braces_in_values() {
|
||||
assert_eq!(interpolate("{second} then {first}", &[("first", "{second}"), ("second", "B")]), "B then {second}");
|
||||
|
||||
@@ -271,6 +271,7 @@
|
||||
"ui.shell": "Hülle",
|
||||
"ui.show": "Einblenden",
|
||||
"ui.show_constraints": "Bedingungen",
|
||||
"ui.show_construction_geometries": "Konstruktionsgeometrien",
|
||||
"ui.show_dimensions": "Maße",
|
||||
"ui.show_points": "Punkte anzeigen",
|
||||
"ui.show_profile": "Profil anzeigen",
|
||||
|
||||
@@ -554,6 +554,7 @@
|
||||
"ui.shell": "Shell",
|
||||
"ui.show": "Show",
|
||||
"ui.show_constraints": "Constraints",
|
||||
"ui.show_construction_geometries": "Construction Geometries",
|
||||
"ui.show_dimensions": "Dimensions",
|
||||
"ui.show_points": "Show Points",
|
||||
"ui.show_profile": "Show Profile",
|
||||
|
||||
@@ -554,6 +554,7 @@
|
||||
"ui.shell": "シェル",
|
||||
"ui.show": "表示",
|
||||
"ui.show_constraints": "拘束",
|
||||
"ui.show_construction_geometries": "構築ジオメトリ",
|
||||
"ui.show_dimensions": "寸法",
|
||||
"ui.show_points": "点を表示",
|
||||
"ui.show_profile": "プロファイルを表示",
|
||||
|
||||
@@ -271,6 +271,7 @@
|
||||
"ui.shell": "쉘",
|
||||
"ui.show": "표시",
|
||||
"ui.show_constraints": "구속 조건",
|
||||
"ui.show_construction_geometries": "구성 형상",
|
||||
"ui.show_dimensions": "치수",
|
||||
"ui.show_points": "점 표시",
|
||||
"ui.show_profile": "프로파일 표시",
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
//! command dialog. Feature Options: the modes of the creation tool that is running, as icon
|
||||
//! buttons. Options: the line type of the selected curves (normal, construction, centerline),
|
||||
//! Look At, and the display toggles kept with the sketch (grid, snap, slice, profiles, points,
|
||||
//! dimensions, constraints, projected geometry, 3D sketch); the sketch's degrees of freedom;
|
||||
//! Finish Sketch. Toggles run `sketch.options`, line types `sketch.construction` /
|
||||
//! `sketch.centerline`.
|
||||
//! dimensions, constraints, projected geometry, construction geometry, 3D sketch); the sketch's
|
||||
//! degrees of freedom; Finish Sketch. Toggles run `sketch.options`, line types
|
||||
//! `sketch.construction` / `sketch.centerline`.
|
||||
//!
|
||||
//! The line type is also a drawing mode: with nothing selected, Construction (or X) makes what
|
||||
//! is drawn next construction geometry until it is switched back.
|
||||
@@ -33,7 +33,7 @@ const WIDTH: f32 = 236.0;
|
||||
/// The display toggles: option key and label. Plain nouns throughout, no "Show " prefix: the
|
||||
/// checkbox itself already says whether each one is on.
|
||||
///
|
||||
/// Seven of these pass their English source text directly, like the rest of this file's
|
||||
/// Eight of these pass their English source text directly, like the rest of this file's
|
||||
/// `app.tr_label(...)` calls: `Locale::label` looks up a literal English string against every
|
||||
/// other English catalog entry to find its id. "Profile" and "Points" cannot do that safely:
|
||||
/// both already name something else under that same lookup (`SelInput::new("Profile", ...)` /
|
||||
@@ -56,7 +56,7 @@ const WIDTH: f32 = 236.0;
|
||||
/// before the id fallback ever runs). Nobody writes UI copy that looks like a dotted id, so
|
||||
/// this is a remote hazard, not a likely one, but it is why these two ids are spelled out here
|
||||
/// rather than reused anywhere else.
|
||||
pub const TOGGLES: [(&str, &str); 9] = [
|
||||
pub const TOGGLES: [(&str, &str); 10] = [
|
||||
("grid", "Sketch Grid"),
|
||||
("snap", "Snap"),
|
||||
("slice", "Slice"),
|
||||
@@ -65,6 +65,7 @@ pub const TOGGLES: [(&str, &str); 9] = [
|
||||
("show_dimensions", "Dimensions"),
|
||||
("show_constraints", "Constraints"),
|
||||
("show_projected", "Projected Geometries"),
|
||||
("show_construction", "Construction Geometries"),
|
||||
("sketch_3d", "3D Sketch"),
|
||||
];
|
||||
|
||||
@@ -347,6 +348,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
|
||||
"show_dimensions" => !opts.hide_dimensions,
|
||||
"show_constraints" => !opts.hide_constraints,
|
||||
"show_projected" => !opts.hide_projected,
|
||||
"show_construction" => !opts.hide_construction,
|
||||
"sketch_3d" => opts.three_d,
|
||||
_ => false,
|
||||
};
|
||||
|
||||
@@ -855,7 +855,7 @@ fn pick_hits(app: &SolveApp, proj: &Proj, pos: Pos2, other_sketch_points: bool,
|
||||
let Some(ss) = st.sketch(sid) else { continue };
|
||||
let bonus = if s.active_sketch == Some(sid) { 2.0 } else { 0.0 };
|
||||
for (i, c) in ss.sketch.curves.iter().enumerate() {
|
||||
if c.link.is_some() && ss.sketch.view.hide_projected {
|
||||
if !solidcraft_engine::view::sketch_curve_visible(&ss.sketch, i) {
|
||||
continue;
|
||||
}
|
||||
let straight = matches!(c.kind, CurveKind::Line { .. });
|
||||
@@ -2493,7 +2493,7 @@ fn box_select(app: &mut SolveApp, proj: &Proj, bx: BoxSel, add: bool) {
|
||||
// What the selection filter lets through (window: wholly inside; crossing: touching).
|
||||
let off = |k: &str| app.ui.pick_off.iter().any(|x| x == k);
|
||||
for (i, c) in ss.sketch.curves.iter().enumerate().filter(|_| !off("sketch") && !off("sketch_curves")) {
|
||||
if c.link.is_some() && ss.sketch.view.hide_projected {
|
||||
if !solidcraft_engine::view::sketch_curve_visible(&ss.sketch, i) {
|
||||
continue;
|
||||
}
|
||||
let sampled = if bx.crossing {
|
||||
|
||||
Reference in new issue
Block a user