From dd472bee6499c52a66c3471621fe011630db62d1 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Wed, 14 Jun 2023 18:04:45 +0200 Subject: [PATCH] :bug: Fix problem when transforming shape to path --- common/src/app/common/pages/helpers.cljc | 6 ++++-- frontend/src/app/main/data/workspace/path/edition.cljs | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/common/src/app/common/pages/helpers.cljc b/common/src/app/common/pages/helpers.cljc index a9b4fb9660..f9bb170b90 100644 --- a/common/src/app/common/pages/helpers.cljc +++ b/common/src/app/common/pages/helpers.cljc @@ -73,8 +73,10 @@ (= type :svg-raw)) (defn path-shape? - [{:keys [type]}] - (= type :path)) + ([objects id] + (path-shape? (get objects id))) + ([{:keys [type]}] + (= type :path))) (defn unframed-shape? "Checks if it's a non-frame shape in the top level." diff --git a/frontend/src/app/main/data/workspace/path/edition.cljs b/frontend/src/app/main/data/workspace/path/edition.cljs index 7ba97c4dfb..3b623ea57d 100644 --- a/frontend/src/app/main/data/workspace/path/edition.cljs +++ b/frontend/src/app/main/data/workspace/path/edition.cljs @@ -10,6 +10,7 @@ [app.common.data.macros :as dm] [app.common.geom.point :as gpt] [app.common.geom.shapes.path :as upg] + [app.common.pages.helpers :as cph] [app.common.path.commands :as upc] [app.common.path.shapes-to-path :as upsp] [app.common.path.subpaths :as ups] @@ -283,9 +284,12 @@ (ptk/reify ::start-path-edit ptk/UpdateEvent (update [_ state] - (let [edit-path (dm/get-in state [:workspace-local :edit-path id]) + (let [objects (wsh/lookup-page-objects state) + edit-path (dm/get-in state [:workspace-local :edit-path id]) content (st/get-path state :content) - state (st/set-content state (ups/close-subpaths content))] + state (cond-> state + (cph/path-shape? objects id) + (st/set-content (ups/close-subpaths content)))] (cond-> state (or (not edit-path) (= :draw (:edit-mode edit-path))) (assoc-in [:workspace-local :edit-path id] {:edit-mode :move