From 7a37e282d93b056ad6062030a56cf73e19327114 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 24 Nov 2026 12:50:43 -0800 Subject: [PATCH] Undo: putting back a drag's paints names every PaintDefaults field put_back_interaction compares the new-art paints field by field. It now destructures PaintDefaults without `..`, so a field added to the struct does not compile until it is handled there. --- crates/engine/src/session/edit.rs | 38 ++++++++++++++++--------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/crates/engine/src/session/edit.rs b/crates/engine/src/session/edit.rs index 464c92b09e..a70850f44d 100644 --- a/crates/engine/src/session/edit.rs +++ b/crates/engine/src/session/edit.rs @@ -362,31 +362,33 @@ impl Session { } // A change the command made to the new-art paints stays when the next preview or a cancel // puts back the paints the interaction began with (the Live Paint Bucket's colors); the - // parts it left alone keep the interaction's. - let (now, start) = (&self.paint, &mut it.paint); - if now.fill != paint.fill { - start.fill.clone_from(&now.fill); + // parts it left alone keep the interaction's. The pattern lists every field, so a field + // added to `PaintDefaults` does not compile until it is handled here. + let vectorcraft_tools::PaintDefaults { fill, stroke, stroke_width, appearance, opacity, blend, style, inherited } = &self.paint; + let start = &mut it.paint; + if *fill != paint.fill { + start.fill.clone_from(fill); } - if now.stroke != paint.stroke { - start.stroke.clone_from(&now.stroke); + if *stroke != paint.stroke { + start.stroke.clone_from(stroke); } - if now.stroke_width != paint.stroke_width { - start.stroke_width = now.stroke_width; + if *stroke_width != paint.stroke_width { + start.stroke_width = *stroke_width; } - if now.appearance != paint.appearance { - start.appearance.clone_from(&now.appearance); + if *appearance != paint.appearance { + start.appearance.clone_from(appearance); } - if now.opacity != paint.opacity { - start.opacity = now.opacity; + if *opacity != paint.opacity { + start.opacity = *opacity; } - if now.blend != paint.blend { - start.blend = now.blend; + if *blend != paint.blend { + start.blend = *blend; } - if now.style != paint.style { - start.style.clone_from(&now.style); + if *style != paint.style { + start.style.clone_from(style); } - if now.inherited != paint.inherited { - start.inherited = now.inherited; + if *inherited != paint.inherited { + start.inherited = *inherited; } let active = self.active().is_some_and(|d| d.uid == uid); let Some(st) = self.docs.iter_mut().find(|d| d.uid == uid) else { return };