mirror of
https://github.com/penpot/penpot.git
synced 2025-05-18 21:06:11 +02:00
⚡ Improved performance when rendering paths
This commit is contained in:
parent
0654741e28
commit
90532b760a
1 changed files with 12 additions and 4 deletions
|
@ -14,6 +14,12 @@
|
||||||
[app.main.ui.workspace.shapes.path.common :as pc]
|
[app.main.ui.workspace.shapes.path.common :as pc]
|
||||||
[rumext.alpha :as mf]))
|
[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/defc path-wrapper
|
||||||
{::mf/wrap-props false}
|
{::mf/wrap-props false}
|
||||||
[props]
|
[props]
|
||||||
|
@ -22,11 +28,13 @@
|
||||||
content-modifiers (mf/deref content-modifiers-ref)
|
content-modifiers (mf/deref content-modifiers-ref)
|
||||||
editing-id (mf/deref refs/selected-edition)
|
editing-id (mf/deref refs/selected-edition)
|
||||||
editing? (= editing-id (:id shape))
|
editing? (= editing-id (:id shape))
|
||||||
shape (update shape :content upc/apply-content-modifiers content-modifiers)
|
|
||||||
|
|
||||||
[_ new-selrect]
|
shape
|
||||||
(helpers/content->points+selrect shape (:content shape))
|
(mf/use-memo
|
||||||
shape (assoc shape :selrect new-selrect)]
|
(mf/deps shape content-modifiers)
|
||||||
|
#(cond-> shape
|
||||||
|
(some? content-modifiers)
|
||||||
|
(apply-content-modifiers content-modifiers)))]
|
||||||
|
|
||||||
[:> shape-container {:shape shape
|
[:> shape-container {:shape shape
|
||||||
:pointer-events (when editing? "none")}
|
:pointer-events (when editing? "none")}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue