From 46fe3a6239351b76614a030749b6ae823eb22ca6 Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Tue, 17 Jun 2025 16:17:56 +0200 Subject: [PATCH] :books: Add comments on convoluted variants code (#6704) --- common/src/app/common/logic/libraries.cljc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/common/src/app/common/logic/libraries.cljc b/common/src/app/common/logic/libraries.cljc index d4024bcefa..ebdda40fd9 100644 --- a/common/src/app/common/logic/libraries.cljc +++ b/common/src/app/common/logic/libraries.cljc @@ -1845,9 +1845,16 @@ ;; If the values are already equal, don't copy them (= (get previous-shape attr) (get current-shape attr)) - ;; If the referenced shape on the original component doesn't - ;; have the same value, don't copy it + ;; If both variants (origin and destiny) don't have the same value + ;; for that attribute, don't copy it. ;; Exceptions: :points :selrect and :content can be different + ;; + ;; Sample: + ;; 1. We have a variant with C1 (bg red) and C2 (bg blue). + ;; 2. We make a copy of C1 called Copy. + ;; 3. We set Copy’s bg to green (so it it has an override on the bg). + ;; 4. We switch Copy to use C2 as base. + ;; 5. The bg of Copy now is blue (we ignore the override) (and (not (contains? #{:points :selrect :content} attr)) (not= (get origin-ref-shape attr) (get current-shape attr)))