From 35b442d6a762027c9541a56a1f0fddc6975715d3 Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Wed, 22 Jan 2025 07:58:25 +0100 Subject: [PATCH] :bug: Fix shadows order --- common/src/app/common/files/defaults.cljc | 2 +- common/src/app/common/files/migrations.cljc | 15 ++++++++++++++- frontend/src/app/main/ui/shapes/filters.cljs | 3 ++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/common/src/app/common/files/defaults.cljc b/common/src/app/common/files/defaults.cljc index 50c9ec9cb..a66b70dab 100644 --- a/common/src/app/common/files/defaults.cljc +++ b/common/src/app/common/files/defaults.cljc @@ -6,4 +6,4 @@ (ns app.common.files.defaults) -(def version 60) +(def version 61) diff --git a/common/src/app/common/files/migrations.cljc b/common/src/app/common/files/migrations.cljc index 5449475a3..f7878cf2b 100644 --- a/common/src/app/common/files/migrations.cljc +++ b/common/src/app/common/files/migrations.cljc @@ -1163,6 +1163,18 @@ (update :pages-index update-vals update-container) (update :components update-vals update-container)))) +(defn migrate-up-61 + [data] + (letfn [(update-object [object] + (d/update-when object :shadow #(into [] (reverse %)))) + + (update-container [container] + (d/update-when container :objects update-vals update-object))] + + (-> data + (update :pages-index update-vals update-container) + (update :components update-vals update-container)))) + (def migrations "A vector of all applicable migrations" [{:id 2 :migrate-up migrate-up-2} @@ -1213,5 +1225,6 @@ {:id 56 :migrate-up migrate-up-56} {:id 57 :migrate-up migrate-up-57} {:id 59 :migrate-up migrate-up-59} - {:id 60 :migrate-up migrate-up-60}]) + {:id 60 :migrate-up migrate-up-60} + {:id 61 :migrate-up migrate-up-61}]) diff --git a/frontend/src/app/main/ui/shapes/filters.cljs b/frontend/src/app/main/ui/shapes/filters.cljs index 5d23c26ab..ae24f3451 100644 --- a/frontend/src/app/main/ui/shapes/filters.cljs +++ b/frontend/src/app/main/ui/shapes/filters.cljs @@ -161,7 +161,8 @@ (mf/defc filters [{:keys [filter-id shape]}] - (let [filters (-> shape gsb/shape->filters change-filter-in) + (let [shape' (update shape :shadow reverse) + filters (-> shape' gsb/shape->filters change-filter-in) bounds (gsb/get-rect-filter-bounds (:selrect shape) filters (or (-> shape :blur :value) 0)) padding (gsb/calculate-padding shape) selrect (:selrect shape)