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:
parent
51e4bf82f2
commit
86e31e7e86
1 changed files with 20 additions and 18 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue