diff --git a/common/src/app/common/pages/helpers.cljc b/common/src/app/common/pages/helpers.cljc index a9b4fb966..f9bb170b9 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 7ba97c4df..3b623ea57 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