Add minor optimizations on workspace/shapes ns

This commit is contained in:
Andrey Antukh 2023-09-06 14:51:27 +02:00
parent d3c9bf1e76
commit c7ae8b6510

View file

@ -94,26 +94,27 @@
(and (some? active-frames) (and (some? active-frames)
(not (contains? active-frames shape-id))) (not (contains? active-frames shape-id)))
opts #js {:shape shape :thumbnail? thumbnail?} props #js {:shape shape :thumbnail? thumbnail?}
[wrapper wrapper-props] rawsvg? (= :svg-raw shape-type)
(if (= :svg-raw shape-type) wrapper-elem (if ^boolean rawsvg? mf/Fragment "g")
[mf/Fragment nil] wrapper-props (if ^boolean rawsvg?
["g" #js {:className "workspace-shape-wrapper"}])] #js {:className "workspace-shape-wrapper"}
#js {})]
(when (and (some? shape) (when (and (some? shape)
(not ^boolean (:hidden shape))) (not ^boolean (:hidden shape)))
[:> wrapper wrapper-props [:> wrapper-elem wrapper-props
(case shape-type (case shape-type
:path [:> path/path-wrapper opts] :path [:> path/path-wrapper props]
:text [:> text/text-wrapper opts] :text [:> text/text-wrapper props]
:group [:> group-wrapper opts] :group [:> group-wrapper props]
:rect [:> rect-wrapper opts] :rect [:> rect-wrapper props]
:image [:> image-wrapper opts] :image [:> image-wrapper props]
:circle [:> circle-wrapper opts] :circle [:> circle-wrapper props]
:svg-raw [:> svg-raw-wrapper opts] :svg-raw [:> svg-raw-wrapper props]
:bool [:> bool-wrapper opts] :bool [:> bool-wrapper props]
:frame [:> nested-frame-wrapper opts] :frame [:> nested-frame-wrapper props]
nil)]))) nil)])))