0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-04-09 13:31:23 -05:00

🐛 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
(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]
(let [component-shape (get-component-shape objects shape {:allow-main? true})]
(:main-instance component-shape)))
(cond
(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?
"Check if the shape is part of any component (main or copy), wether it's
head or not."
[objects shape]
(or (ctk/in-component-copy? shape)
(ctk/main-instance? shape)
(in-component-main? objects shape)))
(ctk/instance-head? shape)
(component-main? objects shape)))
(defn make-component-shape
"Clone the shape and all children. Generate new ids and detach