From afba5ff08315bb81aba3cf71f5e278386f164d86 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Wed, 12 Jan 2022 15:55:29 +0100 Subject: [PATCH] :bug: Fix issues when updating selrect in paths --- CHANGES.md | 1 + .../app/main/data/workspace/path/changes.cljs | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index abefc839d..ebbe84489 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -52,6 +52,7 @@ - Fix blur input field when click on viewport [Taiga #2164](https://tree.taiga.io/project/penpot/issue/2164) - Fix default page id in workspace [Taiga #2205](https://tree.taiga.io/project/penpot/issue/2205) - Fix problem when importing a file with grids [Taiga #2314](https://tree.taiga.io/project/penpot/issue/2314) +- Fix issues when updating selrect in paths [Taiga #2366](https://tree.taiga.io/project/penpot/issue/2366) ### :arrow_up: Deps updates diff --git a/frontend/src/app/main/data/workspace/path/changes.cljs b/frontend/src/app/main/data/workspace/path/changes.cljs index ba0700bf3..c31745bab 100644 --- a/frontend/src/app/main/data/workspace/path/changes.cljs +++ b/frontend/src/app/main/data/workspace/path/changes.cljs @@ -29,7 +29,12 @@ [old-points old-selrect] (helpers/content->points+selrect shape old-content) [new-points new-selrect] (helpers/content->points+selrect shape new-content) - rch (if (empty? new-content) + rch (cond + ;; https://tree.taiga.io/project/penpot/issue/2366 + (nil? shape-id) + [] + + (empty? new-content) [{:type :del-obj :id shape-id :page-id page-id} @@ -37,6 +42,7 @@ :page-id page-id :shapes [shape-id]}] + :else [{:type :mod-obj :id shape-id :page-id page-id @@ -47,7 +53,12 @@ :page-id page-id :shapes [shape-id]}]) - uch (if (empty? new-content) + uch (cond + ;; https://tree.taiga.io/project/penpot/issue/2366 + (nil? shape-id) + [] + + (empty? new-content) [{:type :add-obj :id shape-id :obj shape @@ -58,6 +69,8 @@ {:type :reg-objects :page-id page-id :shapes [shape-id]}] + + :else [{:type :mod-obj :id shape-id :page-id page-id