From bc9be7846acd61bf32950efb681a6bf137bd89e8 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Thu, 19 Jan 2023 14:14:35 +0100 Subject: [PATCH 1/3] :bug: Fix problem with empty mask on layout --- common/src/app/common/geom/shapes/modifiers.cljc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/app/common/geom/shapes/modifiers.cljc b/common/src/app/common/geom/shapes/modifiers.cljc index 15cfdd9c0..9b859a5ae 100644 --- a/common/src/app/common/geom/shapes/modifiers.cljc +++ b/common/src/app/common/geom/shapes/modifiers.cljc @@ -132,7 +132,7 @@ children (cph/get-immediate-children objects shape-id)] (cond - (cph/mask-shape? shape) + (and (cph/mask-shape? shape) (seq children)) (get-group-bounds objects bounds modif-tree (-> children first)) (cph/group-shape? shape) From f38197b2277e474d46b8f7a675dfb6af1c58cf6a Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Thu, 19 Jan 2023 15:10:36 +0100 Subject: [PATCH 2/3] :sparkles: Remove restriction to move mask layers --- common/src/app/common/pages/changes.cljc | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/common/src/app/common/pages/changes.cljc b/common/src/app/common/pages/changes.cljc index 334edefb1..e8abf30fb 100644 --- a/common/src/app/common/pages/changes.cljc +++ b/common/src/app/common/pages/changes.cljc @@ -200,21 +200,9 @@ (cph/insert-at-index prev-shapes index shapes) (cph/append-at-the-end prev-shapes shapes)))) - (check-insert-items [prev-shapes parent index shapes] - (if-not (:masked-group? parent) - (insert-items prev-shapes index shapes) - ;; For masked groups, the first shape is the mask - ;; and it cannot be moved. - (let [mask-id (first prev-shapes) - other-ids (rest prev-shapes) - not-mask-shapes (without-obj shapes mask-id) - new-index (if (nil? index) nil (max (dec index) 0)) - new-shapes (insert-items other-ids new-index not-mask-shapes)] - (into [mask-id] new-shapes)))) - (add-to-parent [parent index shapes] (let [parent (-> parent - (update :shapes check-insert-items parent index shapes) + (update :shapes insert-items index shapes) ;; We need to ensure that no `nil` in the ;; shapes list after adding all the ;; incoming shapes to the parent. From 0743b0766708f157da317c28bb73c3350f76f2eb Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Thu, 19 Jan 2023 17:02:27 +0100 Subject: [PATCH 3/3] :bug: Fix problem with mask disappearing in root frame --- frontend/src/app/main/ui/shapes/mask.cljs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/frontend/src/app/main/ui/shapes/mask.cljs b/frontend/src/app/main/ui/shapes/mask.cljs index d0685a5f5..f74e3a664 100644 --- a/frontend/src/app/main/ui/shapes/mask.cljs +++ b/frontend/src/app/main/ui/shapes/mask.cljs @@ -78,6 +78,13 @@ :y (:y mask-bb-rect) :width (:width mask-bb-rect) :height (:height mask-bb-rect) + + ;; This is necesary to prevent a race condition in the dynamic-modifiers whether the modifier + ;; triggers afte the render + :data-old-x (:x mask-bb-rect) + :data-old-y (:y mask-bb-rect) + :data-old-width (:width mask-bb-rect) + :data-old-height (:height mask-bb-rect) :mask-units "userSpaceOnUse"} [:g {:filter (when-not svg-text? (filter-url render-id mask))} [:& shape-wrapper {:shape (-> mask (dissoc :shadow :blur) (assoc :is-mask? true))}]]]])))