From d2d7803186f89c1f6351c097a36144c9bc4c3895 Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Fri, 23 Sep 2022 14:05:35 +0200 Subject: [PATCH 1/2] :bug: Fix export bounding box mask --- CHANGES.md | 1 + common/src/app/common/geom/shapes/bounds.cljc | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index d86a920e7..fc43af955 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -22,6 +22,7 @@ - Fix error after user drags any layer in search functionality [Taiga #4161](https://tree.taiga.io/project/penpot/issue/4161) - 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) ## 1.15.3-beta diff --git a/common/src/app/common/geom/shapes/bounds.cljc b/common/src/app/common/geom/shapes/bounds.cljc index 3220d2548..33227cc36 100644 --- a/common/src/app/common/geom/shapes/bounds.cljc +++ b/common/src/app/common/geom/shapes/bounds.cljc @@ -133,7 +133,7 @@ (-> (get-shape-filter-bounds shape) (add-padding (calculate-padding shape true)))) - bounds (if (cph/frame-shape? shape) + bounds (if (or (:masked-group? shape) (cph/frame-shape? shape)) [(calculate-base-bounds shape)] (cph/reduce-objects objects From 3ea3ca3bd9fad955e1d1f0fdc79dd705acd8230c Mon Sep 17 00:00:00 2001 From: Eva Date: Mon, 26 Sep 2022 11:05:00 +0200 Subject: [PATCH 2/2] :bug: Fix delete layers in bulk --- CHANGES.md | 1 + .../app/main/data/workspace/selection.cljs | 10 +++++ .../app/main/ui/workspace/sidebar/layers.cljs | 41 ++++++++++++------- 3 files changed, 38 insertions(+), 14 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index fc43af955..b1f2b9b55 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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 diff --git a/frontend/src/app/main/data/workspace/selection.cljs b/frontend/src/app/main/data/workspace/selection.cljs index 72d3298fb..93d187f80 100644 --- a/frontend/src/app/main/data/workspace/selection.cljs +++ b/frontend/src/app/main/data/workspace/selection.cljs @@ -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 diff --git a/frontend/src/app/main/ui/workspace/sidebar/layers.cljs b/frontend/src/app/main/ui/workspace/sidebar/layers.cljs index 87265242d..879e39fb2 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/layers.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/layers.cljs @@ -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}]])]))