From 819c7ea814b4e23e55c104d92e67084e29193220 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 20 Jun 2023 11:18:19 +0200 Subject: [PATCH] :zap: Add micro optimization to handle-area-selection event impl --- frontend/src/app/main/data/workspace/selection.cljs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/frontend/src/app/main/data/workspace/selection.cljs b/frontend/src/app/main/data/workspace/selection.cljs index 18e48517c..8a09b2269 100644 --- a/frontend/src/app/main/data/workspace/selection.cljs +++ b/frontend/src/app/main/data/workspace/selection.cljs @@ -15,6 +15,7 @@ [app.common.pages.changes-builder :as pcb] [app.common.pages.focus :as cpf] [app.common.pages.helpers :as cph] + [app.common.record :as cr] [app.common.types.component :as ctk] [app.common.types.file :as ctf] [app.common.types.page :as ctp] @@ -68,15 +69,15 @@ calculate-selrect (fn [selrect [delta space?]] - (let [selrect (-> selrect - (update :x2 + (:x delta)) - (update :y2 + (:y delta))) + (let [selrect (-> (cr/clone selrect) + (cr/update! :x2 + (:x delta)) + (cr/update! :y2 + (:y delta))) selrect (if ^boolean space? (-> selrect - (update :x1 + (:x delta)) - (update :y1 + (:y delta))) + (cr/update! :x1 + (:x delta)) + (cr/update! :y1 + (:y delta))) selrect)] - (grc/update-rect selrect :corners))) + (grc/update-rect! selrect :corners))) selrect-stream (->> ms/mouse-position