From b5796b4cdb090338e0ac7a2aeaeb21f252ed6992 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 28 Jul 2022 08:38:40 +0200 Subject: [PATCH] :zap: Efficiency improvements on outlines component --- .../main/ui/workspace/viewport/outline.cljs | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/viewport/outline.cljs b/frontend/src/app/main/ui/workspace/viewport/outline.cljs index ca2b126c7..17bd7734b 100644 --- a/frontend/src/app/main/ui/workspace/viewport/outline.cljs +++ b/frontend/src/app/main/ui/workspace/viewport/outline.cljs @@ -92,18 +92,17 @@ edition (obj/get props "edition") zoom (obj/get props "zoom") - outlines (set/union selected hover) + lookup (d/getf objects) + edition? (fn [o] (= edition o)) + + shapes (-> #{} + (into (comp (remove edition?) + (keep lookup) + (filter show-outline?)) + (set/union selected hover)) + (into (comp (remove edition?) + (keep lookup)) + highlighted))] - shapes (d/concat-set - (->> outlines - (filter #(not= edition %)) - (map #(get objects %)) - (filterv show-outline?) - (filter some?)) - ;; outline highlighted shapes even if they are hidden or blocked - (->> highlighted - (filter #(not= edition %)) - (map #(get objects %)) - (filter some?)))] [:g.outlines [:& shape-outlines-render {:shapes shapes :zoom zoom}]]))