0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-04-06 12:01:19 -05:00

Simplify drawtools sidebar main data structure.

This commit is contained in:
Andrey Antukh 2016-08-12 22:04:34 +03:00
parent 49c44766ba
commit e701793e44
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95

View file

@ -64,31 +64,30 @@
:content "Hello world"})
(def +draw-tools+
{:rect
{:icon i/box
[{:icon i/box
:help (tr "ds.help.rect")
:shape +draw-tool-rect+
:priority 1}
:circle
{:icon i/circle
:help (tr "ds.help.circle")
:shape +draw-tool-circle+
:priority 2}
:line
{:icon i/line
:help (tr "ds.help.line")
:shape +draw-tool-line+
:priority 3}
:text
{:icon i/text
:help (tr "ds.help.text")
:shape +draw-tool-text+
:priority 4}
:path
{:icon i/curve
:help (tr "ds.help.path")
:shape +draw-tool-path+
:priority 5}})
:priority 5}
{:icon i/pencil
:help (tr "ds.help.path")
:shape (assoc +draw-tool-path+ :free true)
:priority 6}])
;; --- Draw Toolbox (Component)
@ -110,11 +109,11 @@
[:span (tr "ds.draw-tools")]
[:div.tool-window-close {:on-click close} i/close]]
[:div.tool-window-content
(for [[key props] tools
(for [[i props] (map-indexed vector tools)
:let [selected? (= drawing (:shape props))]]
[:div.tool-btn.tooltip.tooltip-hover
{:alt (:help props)
:class (when selected? "selected")
:key (name key)
:key (str i)
:on-click (partial select-for-draw (:shape props))}
(:icon props)])]]))