🐛 Fix copies have select color wrong

This commit is contained in:
Pablo Alba 2023-07-28 13:11:24 +02:00 committed by Andrés Moya
parent f76f4615cf
commit 340fe75204

View File

@ -113,22 +113,26 @@
:else :else
(get-component-shape objects (get objects (:parent-id shape)) options)))) (get-component-shape objects (get objects (:parent-id shape)) options))))
(defn in-component-main?
"Check if the shape is inside a component non-main instance.
Note that we must iterate on the parents because non-root shapes in
a main component have not any discriminating attribute." (defn component-main?
"Check if the shape is a component main instance or is inside one."
[objects shape] [objects shape]
(let [component-shape (get-component-shape objects shape {:allow-main? true})] (cond
(:main-instance component-shape))) (or (nil? shape) (cph/root? shape))
false
(ctk/main-instance? shape)
true
:else
(component-main? objects (get objects (:parent-id shape)))))
(defn in-any-component? (defn in-any-component?
"Check if the shape is part of any component (main or copy), wether it's "Check if the shape is part of any component (main or copy), wether it's
head or not." head or not."
[objects shape] [objects shape]
(or (ctk/in-component-copy? shape) (or (ctk/in-component-copy? shape)
(ctk/main-instance? shape) (ctk/instance-head? shape)
(in-component-main? objects shape))) (component-main? objects shape)))
(defn make-component-shape (defn make-component-shape
"Clone the shape and all children. Generate new ids and detach "Clone the shape and all children. Generate new ids and detach