From 357e779013e5d1fd96acb7205efa318593c75f40 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 30 Nov 2020 10:30:01 +0100 Subject: [PATCH] :lipstick: Cosmetic changes on pages helpers namespace. --- common/app/common/pages_helpers.cljc | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/common/app/common/pages_helpers.cljc b/common/app/common/pages_helpers.cljc index 8c2f1e561..b49014ed2 100644 --- a/common/app/common/pages_helpers.cljc +++ b/common/app/common/pages_helpers.cljc @@ -262,19 +262,16 @@ "Retrieves a list with the indexes for each element in the layer tree. This will be used for shift+selection." [objects] - (let [rec-index - (fn rec-index [cur-idx id] - (let [object (get objects id) - red-fn - (fn [cur-idx id] - (let [[prev-idx _] (first cur-idx) - prev-idx (or prev-idx 0) - cur-idx (conj cur-idx [(inc prev-idx) id])] - (rec-index cur-idx id)))] - (reduce red-fn cur-idx (reverse (:shapes object)))))] + (letfn [(red-fn [cur-idx id] + (let [[prev-idx _] (first cur-idx) + prev-idx (or prev-idx 0) + cur-idx (conj cur-idx [(inc prev-idx) id])] + (rec-index cur-idx id))) + (rec-index [cur-idx id] + (let [object (get objects id)] + (reduce red-fn cur-idx (reverse (:shapes object)))))] (into {} (rec-index '() uuid/zero)))) - (defn expand-region-selection "Given a selection selects all the shapes between the first and last in an indexed manner (shift selection)" @@ -285,7 +282,7 @@ (map first)) from (apply min filter-indexes) - to (apply max filter-indexes)] + to (apply max filter-indexes)] (->> indexed-shapes (filter (fn [[idx _]] (and (>= idx from) (<= idx to)))) (map second)