From 5ac6dc279bd58a0cdb221acb8d4c9bc46386bd1a Mon Sep 17 00:00:00 2001 From: ramox81 <184937705+ramox81@users.noreply.github.com> Date: Fri, 18 Sep 2026 19:05:37 +0300 Subject: [PATCH] Keep only the end point of a transformed axis-constrained entity pinned 10) A transformed entity with a Horizontal or Vertical relation keeps only its end point where the transform put it; the rest re-aligns to the axis at the retained length, so a rotated vertical line stays vertical below its moved end instead of the whole-entity pin contradicting the axis and leaving the constraint unmet. Co-Authored-By: Claude Fable 5.1 --- src/scene/parametric_solve.rs | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/scene/parametric_solve.rs b/src/scene/parametric_solve.rs index 4d52fe8b4..8d1ccddf8 100644 --- a/src/scene/parametric_solve.rs +++ b/src/scene/parametric_solve.rs @@ -2410,10 +2410,34 @@ fn solve_scope( if fixed_touches(reference.entity) { continue; } + // A transformed entity with a Horizontal/Vertical relation keeps + // only its end point where the transform put it; the rest re-aligns + // to the axis at the retained length (a rotated vertical line stays + // vertical below its moved end, as in the reference) instead of the + // whole-entity pin contradicting the axis and failing the solve. + let axis_pin = reference.marker.is_none().then(|| { + constraints.iter().find_map(|c| { + (c.enabled && matches!(c.kind, ConstraintKind::Horizontal | ConstraintKind::Vertical)) + .then(|| c.refs.iter().find(|r| r.entity == reference.entity)) + .flatten() + .map(|r| match r.directional_axis() { + Some(super::parametric_constraints::DirectionalAxis::TextBaseline) => { + ParametricRef::point(r.entity, 0) + } + Some(_) => ParametricRef::center(r.entity), + None => ParametricRef::point( + r.entity, + r.segment_index().map_or(1, |index| index as i32 + 1), + ), + }) + }) + }) + .flatten(); + let pinned = axis_pin.unwrap_or(*reference); let temporary = ParametricConstraint { id: ConstraintId::MAX, kind: ConstraintKind::Fixed, - refs: vec![*reference], + refs: vec![pinned], driving_param: None, enabled: true, native_origin: None,