mirror of
https://github.com/penpot/penpot.git
synced 2025-05-11 01:26:37 +02:00
🔥 Remove unnecesary shape processing on root-shape
This commit is contained in:
parent
d0a796124f
commit
e805f11f12
1 changed files with 6 additions and 16 deletions
|
@ -50,23 +50,14 @@
|
||||||
(let [objects (obj/get props "objects")
|
(let [objects (obj/get props "objects")
|
||||||
active-frames (obj/get props "active-frames")
|
active-frames (obj/get props "active-frames")
|
||||||
shapes (cph/get-immediate-children objects)
|
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)
|
vbox (mf/use-ctx ctx/current-vbox)
|
||||||
|
|
||||||
shapes
|
shapes (mf/with-memo [shapes vbox]
|
||||||
(mf/with-memo [shapes vbox]
|
(if (some? vbox)
|
||||||
(if (some? vbox)
|
(filter (fn [shape]
|
||||||
(->> shapes
|
(grc/overlaps-rects? vbox (dm/get-prop shape :selrect)))
|
||||||
(filterv (fn [shape]
|
shapes)
|
||||||
(grc/overlaps-rects? vbox (dm/get-prop shape :selrect)))))
|
shapes))]
|
||||||
shapes))]
|
|
||||||
|
|
||||||
[:g {:id (dm/str "shape-" uuid/zero)}
|
[:g {:id (dm/str "shape-" uuid/zero)}
|
||||||
[:& (mf/provider ctx/active-frames) {:value active-frames}
|
[:& (mf/provider ctx/active-frames) {:value active-frames}
|
||||||
|
@ -83,7 +74,6 @@
|
||||||
(if ^boolean (cph/frame-shape? shape)
|
(if ^boolean (cph/frame-shape? shape)
|
||||||
[:& root-frame-wrapper
|
[:& root-frame-wrapper
|
||||||
{:shape shape
|
{:shape shape
|
||||||
:objects (get frame-objects (dm/get-prop shape :id))
|
|
||||||
:thumbnail? (not (contains? active-frames (dm/get-prop shape :id)))}]
|
:thumbnail? (not (contains? active-frames (dm/get-prop shape :id)))}]
|
||||||
[:& shape-wrapper {:shape shape}])])]]]))
|
[:& shape-wrapper {:shape shape}])])]]]))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue