Merge pull request #6752 from penpot/niwinz-staging-path-editor-fixes

🐛 Fix incorrect path tool handling on shapes not coerced to path
This commit is contained in:
Alejandro Alonso 2025-06-25 07:25:13 +02:00 committed by GitHub
commit e1ce7ec787
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 12 deletions

View file

@ -304,11 +304,8 @@
(ptk/reify ::handle-drawing-end (ptk/reify ::handle-drawing-end
ptk/UpdateEvent ptk/UpdateEvent
(update [_ state] (update [_ state]
(let [content (dm/get-in state [:workspace-drawing :object :content])] (let [content (some-> (dm/get-in state [:workspace-drawing :object :content])
(path/check-path-content))]
(assert (path/check-path-content content)
"expected valid path content instance")
(if (> (count content) 1) (if (> (count content) 1)
(assoc-in state [:workspace-drawing :object :initialized?] true) (assoc-in state [:workspace-drawing :object :initialized?] true)
state))) state)))

View file

@ -7,7 +7,6 @@
(ns app.main.data.workspace.path.tools (ns app.main.data.workspace.path.tools
(:require (:require
[app.common.data.macros :as dm] [app.common.data.macros :as dm]
[app.common.files.helpers :as cfh]
[app.common.types.path :as path] [app.common.types.path :as path]
[app.common.types.path.segment :as path.segment] [app.common.types.path.segment :as path.segment]
[app.main.data.changes :as dch] [app.main.data.changes :as dch]
@ -48,12 +47,10 @@
(changes/generate-path-changes it objects page-id shape (:content shape) new-content)] (changes/generate-path-changes it objects page-id shape (:content shape) new-content)]
(rx/concat (rx/concat
(if (cfh/path-shape? shape) (rx/of (dwsh/update-shapes [id] path/convert-to-path)
(rx/empty) (dch/commit-changes changes))
(rx/of (dwsh/update-shapes [id] path/convert-to-path))) (when (empty? new-content)
(rx/of (dch/commit-changes changes) (rx/of (dwe/clear-edition-mode)))))))))))
(when (empty? new-content)
(dwe/clear-edition-mode)))))))))))
(defn make-corner (defn make-corner
([] ([]