Guide sketch patterns with live previews and editable offsets (#966)

Sketch Mirror, rectangular and circular Pattern, and Offset now show a green live preview that follows the selection and settings; OK commits, Cancel leaves the sketch unchanged. The shared dialogs show the current selection step and source counts, sources can be toggled with Ctrl/Cmd-click, cleared and reselected.

Offsets keep editable driving distance dimensions (One Side, Two Sides, Symmetric) that update the derived curves without moving the source, with undo/redo and save/reopen. Format 19: older files keep their fixed offsets.

New dialog labels in en, zh, ja, de and ko.

Fixes #696. Fixes #517.
This commit is contained in:
Karl Von Richter authored and GitHub committed 2026-10-14 01:58:01 -04:00
1 parent 9c51f9d433
commit 47a7f29485
29 files changed
+1107 -186

No files matched your search

+4 -2
View File
@@ -400,6 +400,8 @@ fn line_dist(p: Vec2, a: Vec2, b: Vec2) -> f64 {
fn residuals(s: &State, k: &ConstraintKind, out: &mut Vec<f64>) {
use ConstraintKind::*;
match *k {
// Offset distances drive derived geometry in refresh_offsets, never source DOFs.
OffsetDistance { .. } => {}
Coincident { p, q } => {
let d = s.p(p) - s.p(q);
out.extend([d.x, d.y]);
@@ -782,7 +784,7 @@ fn block_refs(sk: &Sketch, b: &Block) -> Vec<Ref> {
Tangent { a, b } => tangent(a, b).to_vec(),
Smooth { a, b } => vec![C(a), C(b)],
Symmetric { p, q, l } => vec![P(p), P(q), L(l)],
Fix { .. } => vec![],
Fix { .. } | OffsetDistance { .. } => vec![],
},
Block::TangentAt(_, k, p) => match **k {
ConstraintKind::Tangent { a, b } if freeform(a) || freeform(b) => vec![P(*p), C(a), C(b)],
@@ -1343,7 +1345,7 @@ fn build_blocks<'a>(sk: &'a Sketch, lay: &Layout, on_curve: &[(usize, usize)]) -
}
}
for (i, c) in sk.constraints.iter().enumerate() {
if c.driven {
if c.driven || matches!(c.kind, ConstraintKind::OffsetDistance { .. }) {
continue;
}
raw.push(match touch_point(sk, &c.kind, on_curve) {