mirror of
https://github.com/penpot/penpot.git
synced 2025-01-10 17:00:36 -05:00
🐛 Fixes problems with top-level shape selection
This commit is contained in:
parent
66606b7309
commit
2f0fcaf5d3
2 changed files with 19 additions and 5 deletions
|
@ -175,11 +175,24 @@
|
|||
([objects {:keys [include-frames?] :or {include-frames? false}}]
|
||||
(let [lookup #(get objects %)
|
||||
root (lookup uuid/zero)
|
||||
childs (:shapes root)
|
||||
shapes (->> childs
|
||||
(mapv lookup))]
|
||||
(cond->> shapes
|
||||
include-frames? (filterv #(not= :frame (:type %)))))))
|
||||
root-children (:shapes root)
|
||||
|
||||
lookup-shapes
|
||||
(fn [result id]
|
||||
(if (nil? id)
|
||||
result
|
||||
(let [obj (lookup id)
|
||||
typ (:type obj)
|
||||
children (:shapes obj)]
|
||||
|
||||
(cond-> result
|
||||
(or (not= :frame typ) include-frames?)
|
||||
(d/concat [obj])
|
||||
|
||||
(= :frame typ)
|
||||
(d/concat (map lookup children))))))]
|
||||
|
||||
(reduce lookup-shapes [] root-children))))
|
||||
|
||||
(defn select-frames
|
||||
[objects]
|
||||
|
|
|
@ -574,6 +574,7 @@
|
|||
(let [page-id (:current-page-id state)
|
||||
objects (lookup-page-objects state page-id)
|
||||
to-move-shapes (->> (cp/select-toplevel-shapes objects {:include-frames? false})
|
||||
(filterv #(= (:frame-id %) uuid/zero))
|
||||
(mapv :id)
|
||||
(d/enumerate)
|
||||
(filterv (comp shapes second)))
|
||||
|
|
Loading…
Reference in a new issue