0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-25 00:06:09 -05:00

🔥 Remove unnecesary shape processing on root-shape

This commit is contained in:
Andrey Antukh 2023-09-05 13:32:33 +02:00
parent d0a796124f
commit e805f11f12

View file

@ -50,23 +50,14 @@
(let [objects (obj/get props "objects")
active-frames (obj/get props "active-frames")
shapes (cph/get-immediate-children objects)
;; We group the objects together per frame-id so if an object of a different
;; frame changes won't affect the rendering frame
frame-objects
(mf/with-memo [objects]
(cph/objects-by-frame objects))
vbox (mf/use-ctx ctx/current-vbox)
shapes
(mf/with-memo [shapes vbox]
(if (some? vbox)
(->> shapes
(filterv (fn [shape]
(grc/overlaps-rects? vbox (dm/get-prop shape :selrect)))))
shapes))]
shapes (mf/with-memo [shapes vbox]
(if (some? vbox)
(filter (fn [shape]
(grc/overlaps-rects? vbox (dm/get-prop shape :selrect)))
shapes)
shapes))]
[:g {:id (dm/str "shape-" uuid/zero)}
[:& (mf/provider ctx/active-frames) {:value active-frames}
@ -83,7 +74,6 @@
(if ^boolean (cph/frame-shape? shape)
[:& root-frame-wrapper
{:shape shape
:objects (get frame-objects (dm/get-prop shape :id))
:thumbnail? (not (contains? active-frames (dm/get-prop shape :id)))}]
[:& shape-wrapper {:shape shape}])])]]]))