diff --git a/frontend/uxbox/ui/workspace/toolboxes.cljs b/frontend/uxbox/ui/workspace/toolboxes.cljs index 34f18056f..9dd6d1e13 100644 --- a/frontend/uxbox/ui/workspace/toolboxes.cljs +++ b/frontend/uxbox/ui/workspace/toolboxes.cljs @@ -4,17 +4,21 @@ [uxbox.router :as r] [uxbox.rstore :as rs] [uxbox.state :as s] + [uxbox.shapes :as shapes] + [uxbox.library :as library] + [uxbox.util.data :refer (read-string)] [uxbox.data.workspace :as dw] [uxbox.ui.workspace.base :as wb] [uxbox.ui.icons :as i] [uxbox.ui.mixins :as mx] + [uxbox.ui.dom :as dom] [uxbox.ui.util :as util])) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Draw Tools ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(def ^:staric draw-tools +(def ^:staric +draw-tools+ {:rect {:icon i/box :help "Box (Ctrl + B)" @@ -32,11 +36,11 @@ ;; Draw Tool Box ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defn draw-toolbox-render +(defn draw-tools-render [open-toolboxes] (let [workspace (rum/react wb/workspace-state) close #(rs/emit! (dw/toggle-toolbox :draw)) - tools (->> (into [] draw-tools) + tools (->> (into [] +draw-tools+) (sort-by (comp :priority second)))] (html [:div#form-tools.tool-window @@ -52,20 +56,10 @@ :on-click (constantly nil)} (:icon props)])]]))) -;; #_(for [tool (t/sorted-tools (rum/react t/drawing-tools))] -;; [:div.tool-btn.tooltip.tooltip-hover -;; {:alt (:text tool) -;; :class (when (= (rum/react ws/selected-tool) -;; [(:key tool)]) -;; "selected") -;; :key (:key tool) -;; :on-click #(ws/toggle-tool! [(:key tool)])} -;; (:icon tool)])]]))) - -(def ^:static draw-toolbox +(def ^:static draw-tools (util/component - {:render draw-toolbox-render - :name "draw-toolbox" + {:render draw-tools-render + :name "draw-tools" :mixins [mx/static rum/reactive]})) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -75,9 +69,7 @@ (defn layers-render [] (let [workspace (rum/react wb/workspace-state) - close #(rs/emit! (dw/toggle-toolbox :layers)) - tools (->> (into [] draw-tools) - (sort-by (comp :priority second)))] + close #(rs/emit! (dw/toggle-toolbox :layers))] (html [:div#layers.tool-window [:div.tool-window-bar