mirror of
https://github.com/penpot/penpot.git
synced 2025-03-13 08:11:30 -05:00
Simplified rendering of options toolbox.
This commit is contained in:
parent
3d8fb7f116
commit
016b43e1a5
1 changed files with 17 additions and 13 deletions
|
@ -15,6 +15,7 @@
|
|||
[uxbox.ui.colorpicker :refer (colorpicker)]
|
||||
[uxbox.ui.workspace.recent-colors :refer (recent-colors)]
|
||||
[uxbox.ui.workspace.base :as wb]
|
||||
[uxbox.util.lens :as ul]
|
||||
[uxbox.util.dom :as dom]
|
||||
[uxbox.util.data :refer (parse-int parse-float read-string)]))
|
||||
|
||||
|
@ -536,7 +537,6 @@
|
|||
(defn options-menus-render
|
||||
[own shape]
|
||||
(let [local (:rum/local own)
|
||||
shape (rum/react shape)
|
||||
menus (get +menus-map+ (:type shape))
|
||||
active-menu (:menu @local (first menus))]
|
||||
(html
|
||||
|
@ -558,16 +558,20 @@
|
|||
(mx/component
|
||||
{:render options-menus-render
|
||||
:name "options-menus"
|
||||
:mixins [mx/static rum/reactive (mx/local)]}))
|
||||
:mixins [mx/static (mx/local)]}))
|
||||
|
||||
(def ^:const selected-shape-l
|
||||
(letfn [(getter [state]
|
||||
(let [selected (get-in state [:workspace :selected])]
|
||||
(when (= 1 (count selected))
|
||||
(get-in state [:shapes-by-id (first selected)]))))]
|
||||
(as-> (ul/getter getter) $
|
||||
(l/focus-atom $ st/state))))
|
||||
|
||||
(defn options-toolbox-render
|
||||
[own]
|
||||
(let [workspace (rum/react wb/workspace-l)
|
||||
close #(rs/emit! (dw/toggle-flag :element-options))
|
||||
shape (when (and (:selected workspace)
|
||||
(= (count (:selected workspace)) 1))
|
||||
(let [shape-id (first (:selected workspace))]
|
||||
(l/focus-atom (l/in [:shapes-by-id shape-id]) st/state)))]
|
||||
(let [shape (rum/react selected-shape-l)
|
||||
close #(rs/emit! (dw/toggle-flag :element-options))]
|
||||
(html
|
||||
[:div.elementa-options.tool-window
|
||||
[:div.tool-window-bar
|
||||
|
|
Loading…
Add table
Reference in a new issue