0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-10 17:00:36 -05:00

Merge pull request #3304 from penpot/alotor-fix-shape-to-path

🐛 Fix problem when transforming shape to path
This commit is contained in:
Eva Marco 2023-06-15 10:36:41 +02:00 committed by GitHub
commit 247c950cce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View file

@ -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."

View file

@ -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