Sketch: a dimension's extension lines reach the nearest part of the lines it measures (#1361) (#1388)
A dimension to a line, or between two parallel lines, drew its extension lines from the measured end point and its foot on the other line, so they ran the whole length of the lines to wherever that end happened to be. They now start from the nearest point of each line to the dimension line, and disappear where the dimension line already crosses it. Fixes #1361 Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e95e32d72a
commit
bbfad166b0
4 files changed
+79
-6
No files matched your search
@@ -16,7 +16,7 @@ use egui::{FontId, Pos2, Rect, Shape, Stroke, vec2};
|
||||
use serde_json::json;
|
||||
use solidcraft_engine::Sel;
|
||||
use solidcraft_engine::geom::Vec2;
|
||||
use solidcraft_engine::sketch::{ConstraintKind, DimFrame, chain_centres, default_text, dim_frame, dim_layout};
|
||||
use solidcraft_engine::sketch::{ConstraintKind, DimFrame, chain_centres, default_text, dim_frame, dim_layout_reaching, dim_reach};
|
||||
|
||||
use crate::SolveApp;
|
||||
use crate::theme::Tokens;
|
||||
@@ -516,7 +516,7 @@ pub fn show(app: &mut SolveApp, ui: &egui::Ui, painter: &egui::Painter, proj: &P
|
||||
let half = Vec2::new(f64::from(size.x) * 0.5 * px, f64::from(size.y) * 0.5 * px);
|
||||
// Unplaced linear dimensions sit outside the shape they measure.
|
||||
let away = first_point(sk, &c.kind).and_then(|p| centres.get(p).copied()).unwrap_or(anchor);
|
||||
let lay = dim_layout(&frame, c.text.or_else(|| default_text(&frame, away, px)), px, half);
|
||||
let lay = dim_layout_reaching(&frame, c.text.or_else(|| default_text(&frame, away, px)), px, half, dim_reach(sk, &c.kind));
|
||||
let stroke = Stroke::new(1.0, col);
|
||||
let mut segs = Vec::new();
|
||||
for line in &lay.lines {
|
||||
|
||||
Reference in new issue
Block a user