From 66662440614c568fed84e01f0d3e39f10032c224 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 2 Mar 2017 17:24:02 +0100 Subject: [PATCH] Add impl for new ruler button and add the abilty to hide rules. --- frontend/src/uxbox/main/ui/workspace.cljs | 7 +++++-- .../src/uxbox/main/ui/workspace/header.cljs | 6 +++--- .../main/ui/workspace/sidebar/drawtools.cljs | 20 ++++++++++++------- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/frontend/src/uxbox/main/ui/workspace.cljs b/frontend/src/uxbox/main/ui/workspace.cljs index eff40b22a..2cbe577b8 100644 --- a/frontend/src/uxbox/main/ui/workspace.cljs +++ b/frontend/src/uxbox/main/ui/workspace.cljs @@ -137,8 +137,11 @@ (history-dialog page) ;; Rules - (horizontal-rule) - (vertical-rule) + (when (contains? flags :rules) + (horizontal-rule)) + + (when (contains? flags :rules) + (vertical-rule)) ;; Canvas [:section.workspace-canvas diff --git a/frontend/src/uxbox/main/ui/workspace/header.cljs b/frontend/src/uxbox/main/ui/workspace/header.cljs index db0ec06e3..0b9bab382 100644 --- a/frontend/src/uxbox/main/ui/workspace/header.cljs +++ b/frontend/src/uxbox/main/ui/workspace/header.cljs @@ -119,9 +119,9 @@ i/image]] [:ul.options-btn [:li.tooltip.tooltip-bottom - {:alt "Ruler (Ctrl + R)" - :class (when (contains? flags :ruler) "selected") - :on-click (partial toggle :ruler)} + {:alt "Rules" + :class (when (contains? flags :rules) "selected") + :on-click (partial toggle :rules)} i/ruler] [:li.tooltip.tooltip-bottom {:alt "Grid (Ctrl + G)" diff --git a/frontend/src/uxbox/main/ui/workspace/sidebar/drawtools.cljs b/frontend/src/uxbox/main/ui/workspace/sidebar/drawtools.cljs index 3a8ca93a3..a113d0daf 100644 --- a/frontend/src/uxbox/main/ui/workspace/sidebar/drawtools.cljs +++ b/frontend/src/uxbox/main/ui/workspace/sidebar/drawtools.cljs @@ -87,11 +87,7 @@ {:icon i/pencil :help (tr "ds.help.path") :shape +draw-tool-curve+ - :priority 6} - {:icon i/ruler-tool - :help (tr "ds.help.path") - :shape +draw-tool-curve+ - :priority 7}]) + :priority 6}]) ;; --- Draw Toolbox (Component) @@ -104,9 +100,12 @@ {:mixins [mx/static mx/reactive]} [] (let [drawing-tool (mx/react refs/selected-drawing-tool) + flags (mx/react refs/flags) close #(st/emit! (dw/toggle-flag :drawtools)) tools (->> (into [] +draw-tools+) - (sort-by (comp :priority second)))] + (sort-by (comp :priority second))) + toggle-flag #(st/emit! (dw/toggle-flag %))] + [:div#form-tools.tool-window.drawing-tools [:div.tool-window-bar [:div.tool-window-icon i/window] @@ -120,4 +119,11 @@ :class (when selected? "selected") :key (str i) :on-click (partial select-for-draw (:shape props))} - (:icon props)])]])) + (:icon props)]) + + [:div.tool-btn.tooltip.tooltip-hover + {:alt "Ruler" + :on-click (partial toggle-flag :ruler) + :class (when (contains? flags :ruler) "selected")} + i/ruler-tool]]])) +