mirror of
https://github.com/penpot/penpot.git
synced 2025-05-30 19:16:10 +02:00
⚡ Remove props conversion overhead on shape-options component
With using new rumext call convention with :> handler and * on the component name.
This commit is contained in:
parent
12fa4fdef5
commit
9b2315d39d
1 changed files with 20 additions and 14 deletions
|
@ -42,14 +42,19 @@
|
||||||
|
|
||||||
;; --- Options
|
;; --- Options
|
||||||
|
|
||||||
(mf/defc shape-options
|
(mf/defc shape-options*
|
||||||
{::mf/wrap [#(mf/throttle % 60)]}
|
{::mf/wrap [#(mf/throttle % 60)]}
|
||||||
[{:keys [shape shapes-with-children page-id file-id shared-libs]}]
|
[{:keys [shape shapes-with-children page-id file-id shared-libs]}]
|
||||||
(let [workspace-modifiers (mf/deref refs/workspace-modifiers)
|
(let [shape-type (dm/get-prop shape :type)
|
||||||
modifiers (get-in workspace-modifiers [(:id shape) :modifiers])
|
shape-id (dm/get-prop shape :id)
|
||||||
shape (gsh/transform-shape shape modifiers)]
|
|
||||||
|
modifiers (mf/deref refs/workspace-modifiers)
|
||||||
|
modifiers (dm/get-in modifiers [shape-id :modifiers])
|
||||||
|
|
||||||
|
shape (gsh/transform-shape shape modifiers)]
|
||||||
|
|
||||||
[:*
|
[:*
|
||||||
(case (:type shape)
|
(case shape-type
|
||||||
:frame [:& frame/options {:shape shape :shape-with-children shapes-with-children :file-id file-id :shared-libs shared-libs}]
|
:frame [:& frame/options {:shape shape :shape-with-children shapes-with-children :file-id file-id :shared-libs shared-libs}]
|
||||||
:group [:& group/options {:shape shape :shape-with-children shapes-with-children :file-id file-id :shared-libs shared-libs}]
|
:group [:& group/options {:shape shape :shape-with-children shapes-with-children :file-id file-id :shared-libs shared-libs}]
|
||||||
:text [:& text/options {:shape shape :file-id file-id :shared-libs shared-libs}]
|
:text [:& text/options {:shape shape :file-id file-id :shared-libs shared-libs}]
|
||||||
|
@ -73,7 +78,7 @@
|
||||||
(when (= (:type panel) :component-swap)
|
(when (= (:type panel) :component-swap)
|
||||||
[:& component-menu {:shapes (:shapes panel) :swap-opened? true}]))
|
[:& component-menu {:shapes (:shapes panel) :swap-opened? true}]))
|
||||||
|
|
||||||
(mf/defc design-menu
|
(mf/defc design-menu*
|
||||||
{::mf/wrap [mf/memo]}
|
{::mf/wrap [mf/memo]}
|
||||||
[{:keys [selected objects page-id file-id selected-shapes shapes-with-children]}]
|
[{:keys [selected objects page-id file-id selected-shapes shapes-with-children]}]
|
||||||
(let [sp-panel (mf/deref refs/specialized-panel)
|
(let [sp-panel (mf/deref refs/specialized-panel)
|
||||||
|
@ -104,7 +109,7 @@
|
||||||
[:& specialized-panel {:panel sp-panel}]
|
[:& specialized-panel {:panel sp-panel}]
|
||||||
|
|
||||||
(d/not-empty? drawing)
|
(d/not-empty? drawing)
|
||||||
[:& shape-options
|
[:> shape-options*
|
||||||
{:shape (:object drawing)
|
{:shape (:object drawing)
|
||||||
:page-id page-id
|
:page-id page-id
|
||||||
:file-id file-id
|
:file-id file-id
|
||||||
|
@ -114,7 +119,7 @@
|
||||||
[:& page/options]
|
[:& page/options]
|
||||||
|
|
||||||
(= 1 (count selected))
|
(= 1 (count selected))
|
||||||
[:& shape-options
|
[:> shape-options*
|
||||||
{:shape (first selected-shapes)
|
{:shape (first selected-shapes)
|
||||||
:page-id page-id
|
:page-id page-id
|
||||||
:file-id file-id
|
:file-id file-id
|
||||||
|
@ -151,12 +156,13 @@
|
||||||
(st/emit! :interrupt (dwc/set-workspace-read-only false)))))
|
(st/emit! :interrupt (dwc/set-workspace-read-only false)))))
|
||||||
|
|
||||||
design-content
|
design-content
|
||||||
(mf/html [:& design-menu {:selected selected
|
(mf/html [:> design-menu*
|
||||||
:objects objects
|
{:selected selected
|
||||||
:page-id page-id
|
:objects objects
|
||||||
:file-id file-id
|
:page-id page-id
|
||||||
:selected-shapes selected-shapes
|
:file-id file-id
|
||||||
:shapes-with-children shapes-with-children}])
|
:selected-shapes selected-shapes
|
||||||
|
:shapes-with-children shapes-with-children}])
|
||||||
|
|
||||||
inspect-content
|
inspect-content
|
||||||
(mf/html [:div {:class (stl/css :element-options :inspect-options)}
|
(mf/html [:div {:class (stl/css :element-options :inspect-options)}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue