0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-13 08:11:30 -05:00

💄 Many cosmetic and indentation changes on outlines component

This commit is contained in:
Andrey Antukh 2022-07-28 08:32:32 +02:00
parent 1477837cbf
commit c3f67e6358

View file

@ -76,32 +76,34 @@
:zoom zoom :zoom zoom
:color color}]))) :color color}])))
(defn- show-outline?
[shape]
(and (not (:hidden shape))
(not (:blocked shape))))
(mf/defc shape-outlines (mf/defc shape-outlines
{::mf/wrap-props false} {::mf/wrap-props false}
[props] [props]
(let [selected (or (obj/get props "selected") #{}) (let [selected (or (obj/get props "selected") #{})
hover (or (obj/get props "hover") #{}) hover (or (obj/get props "hover") #{})
highlighted (or (obj/get props "highlighted") #{}) highlighted (or (obj/get props "highlighted") #{})
objects (obj/get props "objects") objects (obj/get props "objects")
edition (obj/get props "edition") edition (obj/get props "edition")
zoom (obj/get props "zoom") zoom (obj/get props "zoom")
outlines-ids (set/union selected hover) outlines (set/union selected hover)
show-outline? (fn [shape] (and (not (:hidden shape))
(not (:blocked shape))))
shapes (d/concat-set shapes (d/concat-set
(->> outlines-ids (->> outlines
(filter #(not= edition %)) (filter #(not= edition %))
(map #(get objects %)) (map #(get objects %))
(filterv show-outline?) (filterv show-outline?)
(filter some?)) (filter some?))
;; outline highlighted shapes even if they are hidden or blocked ;; outline highlighted shapes even if they are hidden or blocked
(->> highlighted (->> highlighted
(filter #(not= edition %)) (filter #(not= edition %))
(map #(get objects %)) (map #(get objects %))
(filter some?)))] (filter some?)))]
[:g.outlines [:g.outlines
[:& shape-outlines-render {:shapes shapes [:& shape-outlines-render {:shapes shapes :zoom zoom}]]))
:zoom zoom}]]))