0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-25 07:58:49 -05:00

💄 Minor cosmetic changes on refs.

This commit is contained in:
Andrey Antukh 2020-04-10 16:26:19 +02:00 committed by Alonso Torres
parent 51e4bf82f2
commit 86e31e7e86

View file

@ -61,25 +61,27 @@
(get-in % [:workspace-data page-id :objects])))
(l/derive st/state)))
(defn objects-by-id [ids]
(let [set-ids (set ids)]
(-> (l/lens (fn [state]
(let [page-id (get-in state [:workspace-page :id])
objects (get-in state [:workspace-data page-id :objects])]
(mapv #(get objects %) set-ids))))
(l/derive st/state))))
(defn objects-by-id
[ids]
(-> (l/lens (fn [state]
(let [page-id (get-in state [:workspace-page :id])
objects (get-in state [:workspace-data page-id :objects])]
(->> (set ids)
(map #(get objects %))
(filter identity)
(vec)))))
(l/derive st/state)))
(defn is-child-selected? [id]
(let [is-child-selector
(fn [state]
(let [page-id (get-in state [:workspace-page :id])
objects (get-in state [:workspace-data page-id :objects])
selected (get-in state [:workspace-local :selected])
shape (get objects id)
children (helpers/get-children id objects)]
(some selected children)))]
(-> (l/lens is-child-selector)
(defn is-child-selected?
[id]
(letfn [(selector [state]
(let [page-id (get-in state [:workspace-page :id])
objects (get-in state [:workspace-data page-id :objects])
selected (get-in state [:workspace-local :selected])
shape (get objects id)
children (helpers/get-children id objects)]
(some selected children)))]
(-> (l/lens selector)
(l/derive st/state))))
(def selected-shapes