0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-13 16:21:57 -05:00

🐛 Fix bug related to path shape initialization

This commit is contained in:
Andrey Antukh 2023-07-05 12:54:05 +02:00
parent 2c61cfd139
commit 810abe6728
2 changed files with 7 additions and 2 deletions

View file

@ -450,7 +450,9 @@
(defn setup-path
[{:keys [content selrect points] :as shape}]
(let [selrect (or selrect (gsh/content->selrect content))
(let [selrect (or selrect
(gsh/content->selrect content)
(grc/make-rect))
points (or points (grc/rect->points selrect))]
(-> shape
(assoc :selrect selrect)

View file

@ -16,6 +16,7 @@
[app.common.types.shape :as cts]
[app.common.types.shape-tree :as ctst]
[app.common.types.shape.layout :as ctl]
[app.common.uuid :as uuid]
[app.main.data.workspace.drawing.common :as common]
[app.main.data.workspace.state-helpers :as wsh]
[app.main.streams :as ms]
@ -83,7 +84,6 @@
content (gsp/segments->content segments)
selrect (gsh/content->selrect content)
points (grc/rect->points selrect)]
(-> shape
(dissoc :segments)
(assoc :content content)
@ -94,6 +94,7 @@
(<= (count content) 1))
(assoc :initialized? false)))))))))
(defn handle-drawing []
(ptk/reify ::handle-drawing
ptk/WatchEvent
@ -102,6 +103,8 @@
mouse (rx/sample 10 ms/mouse-position)
shape (cts/setup-shape {:type :path
:initialized? true
:frame-id uuid/zero
:parent-id uuid/zero
:segments []})]
(rx/concat
(rx/of #(update % :workspace-drawing assoc :object shape))