Sketch: infinite construction lines (#1359) (#1547)

Thanks @DuBearte.
This commit is contained in:
DuBearte authored and GitHub committed 2026-10-15 22:54:16 -04:00
1 parent bd17eeef0c
commit 987f0be21e
27 files changed
+435 -28

No files matched your search

+18 -1
View File
@@ -490,6 +490,23 @@ pub(crate) fn paint_with(p: &Painter, r: Rect, name: &str, ink: Color32, fill: C
}
p.circle_filled(at(0.5), dot_r, a);
}
"infinite" => {
// An infinite line (#1359): Construction's broken line, with an open arrowhead at
// each end saying it runs on. Accent only, like Construction and Centerline.
let w = line_type_stroke(r);
let at = |t: f32| pen.at(3.0 + 16.0 * t, 19.0 - 16.0 * t);
for (t0, t1) in [(0.0, 0.38), (0.62, 1.0)] {
p.add(Shape::line(vec![at(t0), at(t1)], Stroke::new(w, a)));
}
// Each head: two short strokes back from the tip, either side of the line.
let tip_len = 0.3;
for (tip, back) in [(0.0f32, tip_len), (1.0, 1.0 - tip_len)] {
let (t, b) = (at(tip), at(back));
let along = b - t;
let side = egui::vec2(-along.y, along.x) * 0.55;
p.add(Shape::line(vec![b + side, t, b - side], Stroke::new(w, a)));
}
}
"c_hv" => {
pen.line(&[(4.0, 18.0), (20.0, 18.0)], a);
pen.line(&[(6.0, 4.0), (6.0, 14.0)], a);
@@ -1482,7 +1499,7 @@ mod tests {
/// theme's construction orange) and must not change with `ink`.
#[test]
fn construction_and_centerline_icons_follow_the_callers_accent_only() {
for name in ["construction", "centerline"] {
for name in ["construction", "centerline", "infinite"] {
let base = drawn(name, Color32::BLACK, Color32::WHITE, Color32::from_rgb(1, 2, 3));
let other_accent = drawn(name, Color32::BLACK, Color32::WHITE, Color32::from_rgb(4, 5, 6));
assert_ne!(base, other_accent, "{name} icon must change with the caller's accent colour");
+2
View File
@@ -305,6 +305,7 @@
"cmd.sketch_fit_curves_to_section": "Kurven an Netzquerschnitt anpassen",
"cmd.sketch_glyphs": "Bedingungssymbole",
"cmd.sketch_include_3d": "3D-Geometrie einbeziehen",
"cmd.sketch_infinite": "Unendliche Linie",
"cmd.sketch_insert_dxf": "DXF einfügen",
"cmd.sketch_insert_svg": "SVG einfügen",
"cmd.sketch_inspect": "Skizze prüfen",
@@ -907,6 +908,7 @@
"ui.home": "Start",
"ui.homeView": "Startansicht",
"ui.horizontal_vertical": "Horizontal/Vertikal",
"ui.infinite": "Unendlich",
"ui.insert": "Einfügen",
"ui.inspect": "Prüfen",
"ui.intersect": "Schnitt",
+2
View File
@@ -507,6 +507,7 @@
"cmd.sketch_fit_curves_to_section": "Fit Curves to Mesh Section",
"cmd.sketch_glyphs": "Constraint Glyphs",
"cmd.sketch_include_3d": "Include 3D Geometry",
"cmd.sketch_infinite": "Infinite Line",
"cmd.sketch_insert_dxf": "Insert DXF",
"cmd.sketch_insert_svg": "Insert SVG",
"cmd.sketch_inspect": "Inspect Sketch",
@@ -1139,6 +1140,7 @@
"ui.homeView": "Home View",
"ui.horizontal_vertical": "Horizontal/Vertical",
"ui.import_ellipsis": "Import…",
"ui.infinite": "Infinite",
"ui.insert": "Insert",
"ui.inspect": "Inspect",
"ui.intersect": "Intersect",
+2
View File
@@ -487,6 +487,7 @@
"cmd.sketch_fit_curves_to_section": "Ajuster des courbes à la section du maillage",
"cmd.sketch_glyphs": "Symboles de contraintes",
"cmd.sketch_include_3d": "Inclure une géométrie 3D",
"cmd.sketch_infinite": "Ligne infinie",
"cmd.sketch_insert_dxf": "Insérer un DXF",
"cmd.sketch_insert_svg": "Insérer un SVG",
"cmd.sketch_inspect": "Inspecter l'esquisse",
@@ -979,6 +980,7 @@
"ui.homeView": "Vue d'accueil",
"ui.horizontal_vertical": "Horizontale/Verticale",
"ui.import_ellipsis": "Importer…",
"ui.infinite": "Infinie",
"ui.insert": "Insérer",
"ui.inspect": "Inspecter",
"ui.intersect": "Intersection",
+2
View File
@@ -507,6 +507,7 @@
"cmd.sketch_fit_curves_to_section": "メッシュ断面に曲線をフィット",
"cmd.sketch_glyphs": "拘束記号",
"cmd.sketch_include_3d": "3D ジオメトリを含める",
"cmd.sketch_infinite": "無限線",
"cmd.sketch_insert_dxf": "DXF を挿入",
"cmd.sketch_insert_svg": "SVG を挿入",
"cmd.sketch_inspect": "スケッチを検査",
@@ -1139,6 +1140,7 @@
"ui.homeView": "ホームビュー",
"ui.horizontal_vertical": "水平/垂直",
"ui.import_ellipsis": "インポート…",
"ui.infinite": "無限",
"ui.insert": "挿入",
"ui.inspect": "検査",
"ui.intersect": "交差",
+2
View File
@@ -305,6 +305,7 @@
"cmd.sketch_fit_curves_to_section": "메시 단면에 곡선 맞추기",
"cmd.sketch_glyphs": "구속 기호",
"cmd.sketch_include_3d": "3D 기하 포함",
"cmd.sketch_infinite": "무한선",
"cmd.sketch_insert_dxf": "DXF 삽입",
"cmd.sketch_insert_svg": "SVG 삽입",
"cmd.sketch_inspect": "스케치 검사",
@@ -907,6 +908,7 @@
"ui.home": "홈",
"ui.homeView": "홈 보기",
"ui.horizontal_vertical": "수평/수직",
"ui.infinite": "무한",
"ui.insert": "삽입",
"ui.inspect": "검사",
"ui.intersect": "교차",
+2
View File
@@ -458,6 +458,7 @@
"cmd.sketch_fit_curves_to_section": "Подобрать кривые по сечению меша",
"cmd.sketch_glyphs": "Знаки ограничений",
"cmd.sketch_include_3d": "Включить 3D-геометрию",
"cmd.sketch_infinite": "Бесконечная линия",
"cmd.sketch_insert_dxf": "Вставить DXF",
"cmd.sketch_insert_svg": "Вставить SVG",
"cmd.sketch_inspect": "Инспекция эскиза",
@@ -931,6 +932,7 @@
"ui.homeView": "Главный вид",
"ui.horizontal_vertical": "Горизонталь/Вертикаль",
"ui.import_ellipsis": "Импорт…",
"ui.infinite": "Бесконечная",
"ui.insert": "Вставить",
"ui.inspect": "Инспекция",
"ui.intersect": "Пересечение",
+2
View File
@@ -455,6 +455,7 @@
"cmd.sketch_fit_curves_to_section": "Підігнати криві до перерізу сітки",
"cmd.sketch_glyphs": "Позначки обмежень",
"cmd.sketch_include_3d": "Включити 3D-геометрію",
"cmd.sketch_infinite": "Нескінченна лінія",
"cmd.sketch_insert_dxf": "Вставити DXF",
"cmd.sketch_insert_svg": "Вставити SVG",
"cmd.sketch_inspect": "Перевірити ескіз",
@@ -830,6 +831,7 @@
"ui.homeView": "Головний вид",
"ui.horizontal_vertical": "Горизонталь/вертикаль",
"ui.import_ellipsis": "Імпорт…",
"ui.infinite": "Нескінченна",
"ui.insert": "Вставити",
"ui.inspect": "Перевірити",
"ui.intersect": "Перетин",
+2
View File
@@ -507,6 +507,7 @@
"cmd.sketch_fit_curves_to_section": "将曲线拟合到网格截面",
"cmd.sketch_glyphs": "约束符号",
"cmd.sketch_include_3d": "包含三维几何",
"cmd.sketch_infinite": "无限长直线",
"cmd.sketch_insert_dxf": "插入 DXF",
"cmd.sketch_insert_svg": "插入 SVG",
"cmd.sketch_inspect": "检查草图",
@@ -1139,6 +1140,7 @@
"ui.homeView": "主视图",
"ui.horizontal_vertical": "水平/垂直",
"ui.import_ellipsis": "导入…",
"ui.infinite": "无限",
"ui.insert": "插入",
"ui.inspect": "检查",
"ui.intersect": "相交",