0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-18 10:41:29 -05:00

Improved performance when rendering paths

This commit is contained in:
alonso.torres 2022-06-23 13:24:03 +02:00
parent 0654741e28
commit 90532b760a

View file

@ -14,6 +14,12 @@
[app.main.ui.workspace.shapes.path.common :as pc]
[rumext.alpha :as mf]))
(defn apply-content-modifiers
[shape content-modifiers]
(let [shape (update shape :content upc/apply-content-modifiers content-modifiers)
[_ new-selrect] (helpers/content->points+selrect shape (:content shape))]
(assoc shape :selrect new-selrect)))
(mf/defc path-wrapper
{::mf/wrap-props false}
[props]
@ -22,11 +28,13 @@
content-modifiers (mf/deref content-modifiers-ref)
editing-id (mf/deref refs/selected-edition)
editing? (= editing-id (:id shape))
shape (update shape :content upc/apply-content-modifiers content-modifiers)
[_ new-selrect]
(helpers/content->points+selrect shape (:content shape))
shape (assoc shape :selrect new-selrect)]
shape
(mf/use-memo
(mf/deps shape content-modifiers)
#(cond-> shape
(some? content-modifiers)
(apply-content-modifiers content-modifiers)))]
[:> shape-container {:shape shape
:pointer-events (when editing? "none")}