mirror of
https://github.com/penpot/penpot.git
synced 2025-01-26 08:29:42 -05:00
✨ Change behavior of select-all command
This commit is contained in:
parent
f3d5515795
commit
e69d402b4f
1 changed files with 25 additions and 4 deletions
|
@ -138,14 +138,35 @@
|
||||||
(ptk/reify ::select-all
|
(ptk/reify ::select-all
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ state stream]
|
(watch [_ state stream]
|
||||||
(let [page-id (:current-page-id state)
|
(let [page-id (:current-page-id state)
|
||||||
objects (dwc/lookup-page-objects state page-id)
|
objects (dwc/lookup-page-objects state page-id)
|
||||||
|
new-selected (let [selected-objs
|
||||||
|
(->> (get-in state [:workspace-local :selected])
|
||||||
|
(map #(get objects %)))
|
||||||
|
|
||||||
|
frame-ids
|
||||||
|
(reduce #(conj %1 (:frame-id %2))
|
||||||
|
#{}
|
||||||
|
selected-objs)
|
||||||
|
|
||||||
|
common-frame-id
|
||||||
|
(when (= (count frame-ids) 1) (first frame-ids))]
|
||||||
|
|
||||||
|
(if (and common-frame-id
|
||||||
|
(not= (:id common-frame-id) uuid/zero))
|
||||||
|
(-> (get objects common-frame-id)
|
||||||
|
:shapes)
|
||||||
|
(let [frames (cp/select-frames objects)]
|
||||||
|
(->> (if (seq frames)
|
||||||
|
frames
|
||||||
|
(cp/select-toplevel-shapes objects))
|
||||||
|
(map :id)))))
|
||||||
|
|
||||||
is-not-blocked (fn [shape-id] (not (get-in state [:workspace-data
|
is-not-blocked (fn [shape-id] (not (get-in state [:workspace-data
|
||||||
:pages-index page-id
|
:pages-index page-id
|
||||||
:objects shape-id
|
:objects shape-id
|
||||||
:blocked] false)))]
|
:blocked] false)))]
|
||||||
(rx/of (->> (cp/select-toplevel-shapes objects)
|
(rx/of (->> new-selected
|
||||||
(map :id)
|
|
||||||
(filter is-not-blocked)
|
(filter is-not-blocked)
|
||||||
(into lks/empty-linked-set)
|
(into lks/empty-linked-set)
|
||||||
(select-shapes)))))))
|
(select-shapes)))))))
|
||||||
|
|
Loading…
Add table
Reference in a new issue