mirror of
https://github.com/penpot/penpot.git
synced 2025-01-08 07:50:43 -05:00
Add basic layers toolbox rendering.
This commit is contained in:
parent
e8235fcf02
commit
93b7470b69
2 changed files with 46 additions and 3 deletions
|
@ -67,3 +67,46 @@
|
||||||
{:render draw-toolbox-render
|
{:render draw-toolbox-render
|
||||||
:name "draw-toolbox"
|
:name "draw-toolbox"
|
||||||
:mixins [mx/static rum/reactive]}))
|
:mixins [mx/static rum/reactive]}))
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; Layers
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(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)))]
|
||||||
|
(html
|
||||||
|
[:div#layers.tool-window
|
||||||
|
[:div.tool-window-bar
|
||||||
|
[:div.tool-window-icon i/layers]
|
||||||
|
[:span "Layers"]
|
||||||
|
[:div.tool-window-close {:on-click close} i/close]]
|
||||||
|
[:div.tool-window-content
|
||||||
|
[:ul.element-list
|
||||||
|
#_(for [shape (reverse shapes)]
|
||||||
|
(let [{shape-id :shape/uuid
|
||||||
|
selected? :shape/selected?
|
||||||
|
locked? :shape/locked?
|
||||||
|
visible? :shape/visible?
|
||||||
|
raw-shape :shape/data} shape]
|
||||||
|
[:li {:key shape-id
|
||||||
|
:class (when selected? "selected")}
|
||||||
|
[:div.toggle-element
|
||||||
|
{:class (when visible? "selected")
|
||||||
|
:on-click #(actions/toggle-shape-visibility conn shape-id)} icons/eye]
|
||||||
|
[:div.block-element
|
||||||
|
{:class (when locked? "selected")
|
||||||
|
:on-click #(actions/toggle-shape-lock conn shape-id)} icons/lock]
|
||||||
|
[:div.element-icon
|
||||||
|
(shapes/icon raw-shape)]
|
||||||
|
[:span (shapes/name raw-shape)]]))]]])))
|
||||||
|
|
||||||
|
(def ^:static layers
|
||||||
|
(util/component
|
||||||
|
{:render layers-render
|
||||||
|
:name "layers"
|
||||||
|
:mixins [rum/reactive]}))
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
[uxbox.data.projects :as dp]
|
[uxbox.data.projects :as dp]
|
||||||
[uxbox.ui.workspace.base :as wb]
|
[uxbox.ui.workspace.base :as wb]
|
||||||
[uxbox.ui.workspace.rules :as wr]
|
[uxbox.ui.workspace.rules :as wr]
|
||||||
[uxbox.ui.workspace.toolboxes :refer (draw-toolbox)]))
|
[uxbox.ui.workspace.toolboxes :refer (draw-toolbox layers)]))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; Coordinates Debug
|
;; Coordinates Debug
|
||||||
|
@ -224,8 +224,8 @@
|
||||||
(icon-sets open-toolboxes))
|
(icon-sets open-toolboxes))
|
||||||
#_(when (:components open-setting-boxes)
|
#_(when (:components open-setting-boxes)
|
||||||
(components open-toolboxes components))
|
(components open-toolboxes components))
|
||||||
#_(when (:layers open-setting-boxes)
|
(when (:layers-toolbox-enabled workspace false)
|
||||||
(layers conn open-toolboxes page shapes))]])))
|
(layers))]])))
|
||||||
|
|
||||||
(def aside
|
(def aside
|
||||||
(util/component
|
(util/component
|
||||||
|
|
Loading…
Reference in a new issue