0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-08 16:00:19 -05:00

Merge pull request #2344 from penpot/eva-fix-layers

🐛 Fix delete layers in bulk
This commit is contained in:
Alejandro 2022-09-27 12:30:15 +02:00 committed by GitHub
commit 1be1e94869
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 14 deletions

View file

@ -23,6 +23,7 @@
- Fix font search works only with lowercase letters [Taiga #4140](https://tree.taiga.io/project/penpot/issue/4140)
- Fix Terms and Privacy links overlapping [Taiga #4137](https://tree.taiga.io/project/penpot/issue/4137)
- Fix Export bounding box mask [Taiga #950](https://tree.taiga.io/project/penpot/issue/950)
- Fix delete layers in bulk [Taiga #4160](https://tree.taiga.io/project/penpot/issue/4160)
## 1.15.3-beta

View file

@ -147,6 +147,16 @@
(update-in state [:workspace-local :selected] disj id))))
(defn shift-select-shapes
([id objects]
(ptk/reify ::shift-select-shapes
ptk/UpdateEvent
(update [_ state]
(let [selection (-> state
wsh/lookup-selected
(conj id))]
(-> state
(assoc-in [:workspace-local :selected]
(cph/expand-region-selection objects selection)))))))
([id]
(ptk/reify ::shift-select-shapes
ptk/UpdateEvent

View file

@ -90,7 +90,7 @@
(l/derived refs/workspace-local)))
(mf/defc layer-item
[{:keys [index item selected objects sortable?] :as props}]
[{:keys [index item selected objects sortable? filtered?] :as props}]
(let [id (:id item)
selected? (contains? selected id)
container? (or (cph/frame-shape? item)
@ -134,7 +134,10 @@
(let [id (:id item)]
(cond
(kbd/shift? event)
(st/emit! (dw/shift-select-shapes id))
(if filtered?
(st/emit! (dw/shift-select-shapes id objects))
(st/emit! (dw/shift-select-shapes id)))
(kbd/mod? event)
(st/emit! (dw/select-shape id true))
@ -263,7 +266,7 @@
(mf/defc layers-tree
{::mf/wrap [#(mf/memo % =)
#(mf/throttle % 200)]}
[{:keys [objects] :as props}]
[{:keys [objects filtered?] :as props}]
(let [selected (mf/deref refs/selected-shapes)
selected (hooks/use-equal-memo selected)
root (get objects uuid/zero)]
@ -278,14 +281,16 @@
:index index
:objects objects
:key id
:sortable? true}]
:sortable? true
:filtered? filtered?}]
[:& layer-item
{:item obj
:selected selected
:index index
:objects objects
:key id
:sortable? true}])))]]))
:sortable? true
:filtered? filtered?}])))]]))
(mf/defc filters-tree
{::mf/wrap [#(mf/memo % =)
@ -303,7 +308,8 @@
:index index
:objects objects
:key id
:sortable? false}]))]))
:sortable? false
:filtered? true}]))]))
(defn calc-reparented-objects
@ -531,15 +537,22 @@
filter-component)
(when (some? filtered-objects)
[:div.tool-window-content {:ref on-render-container :key "filters"}
[:& filters-tree {:objects filtered-objects
:key (dm/str (:id page))}]
[:div.lazy {:ref lazy-load-ref
:key "lazy-load"
:style {:min-height 16}}]])
(if (some? filtered-objects)
[:*
[:div.tool-window-content {:ref on-render-container :key "filters"}
[:& filters-tree {:objects filtered-objects
:key (dm/str (:id page))}]
[:div.lazy {:ref lazy-load-ref
:key "lazy-load"
:style {:min-height 16}}]]
[:div.tool-window-content {:on-scroll on-scroll
:style {:display (when (some? filtered-objects) "none")}}
[:& layers-tree {:objects filtered-objects
:key (dm/str (:id page))
:filtered? true}]]]
[:div.tool-window-content {:on-scroll on-scroll
:style {:display (when (some? filtered-objects) "none")}}
[:& layers-tree {:objects objects
:key (dm/str (:id page))}]]]))
:key (dm/str (:id page))
:filtered? false}]])]))