0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-10 00:40:30 -05:00

Improved colorpicker handling

This commit is contained in:
alonso.torres 2020-09-14 11:27:31 +02:00
parent c036543487
commit 4f7603a0a4
2 changed files with 5 additions and 4 deletions

View file

@ -131,10 +131,11 @@
[:& dropdown {:show (:show-menu @state)
:on-close #(swap! state assoc :show-menu false)}
[:ul.workspace-context-menu.palette-menu
(for [cur-library (vals shared-libs)]
(for [[idx cur-library] (map-indexed vector (vals shared-libs))]
(let [colors (-> cur-library (get-in [:data :colors]) vals)]
[:li.palette-library
{:on-click #(st/emit! (mdc/change-palette-selected (:id cur-library)))}
{:key (str "library-" idx)
:on-click #(st/emit! (mdc/change-palette-selected (:id cur-library)))}
(when (= selected (:id cur-library)) i/tick)
[:div.library-name (str (:name cur-library) " " (str/format "(%s)" (count colors)))]
[:div.color-sample

View file

@ -220,14 +220,14 @@
(st/emit! (dwc/stop-picker))
(modal/disallow-click-outside!))]
(mf/use-layout-effect
(mf/use-effect
;; Everytime we finish retrieving a new URL we redraw the canvas
;; so even if we're not finished the user can start to pick basic
;; shapes
(mf/deps props fetch-pending)
(fn []
(try
(timers/schedule 100
(timers/schedule
#(let [svg-node (mf/ref-val svg-ref)
canvas-node (mf/ref-val canvas-ref)
canvas-context (.getContext canvas-node "2d")