0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-18 21:06:11 -05:00

Add impl for new ruler button and add the abilty to hide rules.

This commit is contained in:
Andrey Antukh 2017-03-02 17:24:02 +01:00
parent e453841d66
commit 6666244061
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95
3 changed files with 21 additions and 12 deletions

View file

@ -137,8 +137,11 @@
(history-dialog page) (history-dialog page)
;; Rules ;; Rules
(horizontal-rule) (when (contains? flags :rules)
(vertical-rule) (horizontal-rule))
(when (contains? flags :rules)
(vertical-rule))
;; Canvas ;; Canvas
[:section.workspace-canvas [:section.workspace-canvas

View file

@ -119,9 +119,9 @@
i/image]] i/image]]
[:ul.options-btn [:ul.options-btn
[:li.tooltip.tooltip-bottom [:li.tooltip.tooltip-bottom
{:alt "Ruler (Ctrl + R)" {:alt "Rules"
:class (when (contains? flags :ruler) "selected") :class (when (contains? flags :rules) "selected")
:on-click (partial toggle :ruler)} :on-click (partial toggle :rules)}
i/ruler] i/ruler]
[:li.tooltip.tooltip-bottom [:li.tooltip.tooltip-bottom
{:alt "Grid (Ctrl + G)" {:alt "Grid (Ctrl + G)"

View file

@ -87,11 +87,7 @@
{:icon i/pencil {:icon i/pencil
:help (tr "ds.help.path") :help (tr "ds.help.path")
:shape +draw-tool-curve+ :shape +draw-tool-curve+
:priority 6} :priority 6}])
{:icon i/ruler-tool
:help (tr "ds.help.path")
:shape +draw-tool-curve+
:priority 7}])
;; --- Draw Toolbox (Component) ;; --- Draw Toolbox (Component)
@ -104,9 +100,12 @@
{:mixins [mx/static mx/reactive]} {:mixins [mx/static mx/reactive]}
[] []
(let [drawing-tool (mx/react refs/selected-drawing-tool) (let [drawing-tool (mx/react refs/selected-drawing-tool)
flags (mx/react refs/flags)
close #(st/emit! (dw/toggle-flag :drawtools)) close #(st/emit! (dw/toggle-flag :drawtools))
tools (->> (into [] +draw-tools+) 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#form-tools.tool-window.drawing-tools
[:div.tool-window-bar [:div.tool-window-bar
[:div.tool-window-icon i/window] [:div.tool-window-icon i/window]
@ -120,4 +119,11 @@
:class (when selected? "selected") :class (when selected? "selected")
:key (str i) :key (str i)
:on-click (partial select-for-draw (:shape props))} :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]]]))