From 9e72dbb0a040cdd43893205d0a6bb652abdefc85 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Sun, 24 Jan 2016 00:52:34 +0200 Subject: [PATCH] Add stroke colors into recent colors summary. --- src/uxbox/ui/workspace/recent_colors.cljs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/uxbox/ui/workspace/recent_colors.cljs b/src/uxbox/ui/workspace/recent_colors.cljs index f18080fbb..9f4e391b2 100644 --- a/src/uxbox/ui/workspace/recent_colors.cljs +++ b/src/uxbox/ui/workspace/recent_colors.cljs @@ -26,16 +26,20 @@ #(rs/emit! (dw/toggle-tool :workspace/colorpalette))) (defn- count-color - [state shape] - (let [color (:fill shape)] + [state shape prop] + (let [color (prop shape)] (if (contains? state color) (update state color inc) (assoc state color 1)))) (defn- calculate-colors [shapes] - (let [result (reduce count-color {} shapes)] - (take 5 (map first (sort-by second (into [] result)))))) + (as-> (comp + #(count-color %1 %2 :fill) + #(count-color %1 %2 :stroke)) $ + (reduce $ {} shapes) + (sort-by second (into [] $)) + (take 5 (map first $)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Component