fix(layers): turning layers on no longer re-places associative dimensions

Layer, text-style, dimension-style and object-style invalidation bumped
every dependent entity as Modified, which also re-resolved associative
dimensions, centre marks and hatches and re-ran the parametric solve.
A dimension whose association disagrees with its own points (as older
saves can) jumped its dimension line on LAYON. A restyle moves no
geometry, so it now refreshes display only.

Fixes #1536

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 5.5 committed 2026-09-29 14:16:07 +03:00
1 parent e682f29ce6
commit ea91315ba8
1 file changed
+18 -2
+18 -2
View File
@@ -3349,12 +3349,19 @@ impl Scene {
retained_originals, retained_originals,
&[], &[],
true, true,
false,
); );
} }
/// Refresh display and associations after a solved grip or exact history restore. /// Refresh display and associations after a solved grip or exact history restore.
pub(crate) fn bump_entities_after_parametric_solve(&mut self, changes: &[(Handle, ChangeKind)]) { pub(crate) fn bump_entities_after_parametric_solve(&mut self, changes: &[(Handle, ChangeKind)]) {
self.bump_entities_with_solve_policy(changes, &[], false, &[], &[], false); self.bump_entities_with_solve_policy(changes, &[], false, &[], &[], false, false);
}
/// Refresh display after a restyle that moved no geometry: nothing
/// associated to these entities is re-resolved or re-solved.
pub(crate) fn bump_entities_restyled(&mut self, changes: &[(Handle, ChangeKind)]) {
self.bump_entities_with_solve_policy(changes, &[], false, &[], &[], false, true);
} }
/// Apply a newly-created ordered relation while temporarily anchoring /// Apply a newly-created ordered relation while temporarily anchoring
@@ -3373,6 +3380,7 @@ impl Scene {
&[], &[],
fixed_refs, fixed_refs,
true, true,
false,
); );
} }
@@ -3390,6 +3398,7 @@ impl Scene {
retained_originals, retained_originals,
transformed_refs, transformed_refs,
true, true,
false,
); );
} }
@@ -3401,6 +3410,7 @@ impl Scene {
retained_originals: &[(Handle, EntityType)], retained_originals: &[(Handle, EntityType)],
fixed_refs: &[parametric_constraints::ParametricRef], fixed_refs: &[parametric_constraints::ParametricRef],
solve_parametric: bool, solve_parametric: bool,
appearance_only: bool,
) { ) {
if changes.iter().any(|(handle, kind)| { if changes.iter().any(|(handle, kind)| {
matches!(kind, ChangeKind::Removed) matches!(kind, ChangeKind::Removed)
@@ -3412,6 +3422,11 @@ impl Scene {
self.associative_hatch_source_cache.borrow_mut().take(); self.associative_hatch_source_cache.borrow_mut().take();
} }
let mut changes = changes.to_vec(); let mut changes = changes.to_vec();
// A restyle (layer on/off, colour, text or dimension style) moves no
// geometry, so nothing measured from it is re-resolved: an
// association that disagrees with its dimension would otherwise
// re-place the dimension on a layer toggle.
if !appearance_only {
if self.associative_centers_possible(&changes) { if self.associative_centers_possible(&changes) {
for change in self.refresh_associative_centerlines(&changes) { for change in self.refresh_associative_centerlines(&changes) {
if !changes.iter().any(|(handle, _)| *handle == change.0) { if !changes.iter().any(|(handle, _)| *handle == change.0) {
@@ -3447,6 +3462,7 @@ impl Scene {
} }
} }
} }
}
if !self.parametric_constraints.is_empty() || !self.named_parameters.is_empty() { if !self.parametric_constraints.is_empty() || !self.named_parameters.is_empty() {
self.refresh_dynamic_dimension_texts(); self.refresh_dynamic_dimension_texts();
self.sync_native_parametric_graph(); self.sync_native_parametric_graph();
@@ -11380,7 +11396,7 @@ vis_index={:.1} visible_probe={:.1}",
.into_iter() .into_iter()
.map(|handle| (handle, ChangeKind::Modified)) .map(|handle| (handle, ChangeKind::Modified))
.collect(); .collect();
self.bump_entities(&changes); self.bump_entities_restyled(&changes);
} }
pub fn invalidate_layer_dependencies(&mut self, names: &[String]) { pub fn invalidate_layer_dependencies(&mut self, names: &[String]) {