⚡ Build gap overlay bounds from the flex board's shapes only (#13389)

The flex gap overlay built a lazy map over every object on the page on
each render. It re-renders on every viewport change, so with a flex
board selected panning became very slow, e.g. on the mem_benchmark file.

The layout calculation only needs to look up the frame and its
desendants, so limit it to just that subtree. Panning a page of 50k
shapes goes from ~30fps -> 60fps.

AI-assisted-by: claude-opus-5-5
This commit is contained in:
Luke Lau 2026-11-27 20:57:20 +08:00 committed by GitHub
parent 04e3b73c2d
commit 1cbb532eff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -208,7 +208,8 @@
wrap-blocks
(let [block-children (->> children
(map #(vector (gpo/parent-coords-bounds (:points %) (:points frame)) %)))
bounds (d/lazy-map (keys objects) #(gsh/shape->points (get objects %)))
bounds (d/lazy-map (cfh/get-children-ids-with-self objects frame-id)
#(gsh/shape->points (get objects %)))
layout-data (gsl/calc-layout-data frame (:points frame) block-children bounds objects)
layout-bounds (:layout-bounds layout-data)