mirror of
https://github.com/penpot/penpot.git
synced 2025-05-19 12:16:10 +02:00
Merge pull request #3304 from penpot/alotor-fix-shape-to-path
🐛 Fix problem when transforming shape to path
This commit is contained in:
commit
247c950cce
2 changed files with 10 additions and 4 deletions
|
@ -73,8 +73,10 @@
|
||||||
(= type :svg-raw))
|
(= type :svg-raw))
|
||||||
|
|
||||||
(defn path-shape?
|
(defn path-shape?
|
||||||
[{:keys [type]}]
|
([objects id]
|
||||||
(= type :path))
|
(path-shape? (get objects id)))
|
||||||
|
([{:keys [type]}]
|
||||||
|
(= type :path)))
|
||||||
|
|
||||||
(defn unframed-shape?
|
(defn unframed-shape?
|
||||||
"Checks if it's a non-frame shape in the top level."
|
"Checks if it's a non-frame shape in the top level."
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
[app.common.data.macros :as dm]
|
[app.common.data.macros :as dm]
|
||||||
[app.common.geom.point :as gpt]
|
[app.common.geom.point :as gpt]
|
||||||
[app.common.geom.shapes.path :as upg]
|
[app.common.geom.shapes.path :as upg]
|
||||||
|
[app.common.pages.helpers :as cph]
|
||||||
[app.common.path.commands :as upc]
|
[app.common.path.commands :as upc]
|
||||||
[app.common.path.shapes-to-path :as upsp]
|
[app.common.path.shapes-to-path :as upsp]
|
||||||
[app.common.path.subpaths :as ups]
|
[app.common.path.subpaths :as ups]
|
||||||
|
@ -283,9 +284,12 @@
|
||||||
(ptk/reify ::start-path-edit
|
(ptk/reify ::start-path-edit
|
||||||
ptk/UpdateEvent
|
ptk/UpdateEvent
|
||||||
(update [_ state]
|
(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)
|
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
|
(cond-> state
|
||||||
(or (not edit-path) (= :draw (:edit-mode edit-path)))
|
(or (not edit-path) (= :draw (:edit-mode edit-path)))
|
||||||
(assoc-in [:workspace-local :edit-path id] {:edit-mode :move
|
(assoc-in [:workspace-local :edit-path id] {:edit-mode :move
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue