mirror of
https://github.com/penpot/penpot.git
synced 2025-07-19 16:07:15 +02:00
✨ Simplify frames selection mechanism.
This commit is contained in:
parent
53e6d7ef2a
commit
6812099900
2 changed files with 7 additions and 15 deletions
|
@ -256,20 +256,12 @@
|
||||||
|
|
||||||
(defn select-frames
|
(defn select-frames
|
||||||
[objects]
|
[objects]
|
||||||
(let [root (get objects uuid/zero)
|
(let [lookup #(get objects %)
|
||||||
loopfn (fn loopfn [ids]
|
frame? #(= :frame (:type %))
|
||||||
(let [id (first ids)
|
xform (comp (map lookup)
|
||||||
obj (get objects id)]
|
(filter frame?))]
|
||||||
(cond
|
(->> (:shapes (lookup uuid/zero))
|
||||||
(or (nil? id) (nil? obj))
|
(into [] xform))))
|
||||||
nil
|
|
||||||
|
|
||||||
(= :frame (:type obj))
|
|
||||||
(lazy-seq (cons obj (loopfn (rest ids))))
|
|
||||||
|
|
||||||
:else
|
|
||||||
(lazy-seq (loopfn (rest ids))))))]
|
|
||||||
(loopfn (:shapes root))))
|
|
||||||
|
|
||||||
(defn clone-object
|
(defn clone-object
|
||||||
"Gets a copy of the object and all its children, with new ids
|
"Gets a copy of the object and all its children, with new ids
|
||||||
|
|
|
@ -219,7 +219,7 @@
|
||||||
(l/derived :options workspace-page))
|
(l/derived :options workspace-page))
|
||||||
|
|
||||||
(def workspace-frames
|
(def workspace-frames
|
||||||
(l/derived cp/select-frames workspace-page-objects))
|
(l/derived cp/select-frames workspace-page-objects =))
|
||||||
|
|
||||||
(def workspace-editor
|
(def workspace-editor
|
||||||
(l/derived :workspace-editor st/state))
|
(l/derived :workspace-editor st/state))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue