mirror of
https://github.com/penpot/penpot.git
synced 2025-02-03 21:09:00 -05:00
✨ Improved colorpicker handling
This commit is contained in:
parent
c036543487
commit
4f7603a0a4
2 changed files with 5 additions and 4 deletions
|
@ -131,10 +131,11 @@
|
||||||
[:& dropdown {:show (:show-menu @state)
|
[:& dropdown {:show (:show-menu @state)
|
||||||
:on-close #(swap! state assoc :show-menu false)}
|
:on-close #(swap! state assoc :show-menu false)}
|
||||||
[:ul.workspace-context-menu.palette-menu
|
[: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)]
|
(let [colors (-> cur-library (get-in [:data :colors]) vals)]
|
||||||
[:li.palette-library
|
[: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)
|
(when (= selected (:id cur-library)) i/tick)
|
||||||
[:div.library-name (str (:name cur-library) " " (str/format "(%s)" (count colors)))]
|
[:div.library-name (str (:name cur-library) " " (str/format "(%s)" (count colors)))]
|
||||||
[:div.color-sample
|
[:div.color-sample
|
||||||
|
|
|
@ -220,14 +220,14 @@
|
||||||
(st/emit! (dwc/stop-picker))
|
(st/emit! (dwc/stop-picker))
|
||||||
(modal/disallow-click-outside!))]
|
(modal/disallow-click-outside!))]
|
||||||
|
|
||||||
(mf/use-layout-effect
|
(mf/use-effect
|
||||||
;; Everytime we finish retrieving a new URL we redraw the canvas
|
;; 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
|
;; so even if we're not finished the user can start to pick basic
|
||||||
;; shapes
|
;; shapes
|
||||||
(mf/deps props fetch-pending)
|
(mf/deps props fetch-pending)
|
||||||
(fn []
|
(fn []
|
||||||
(try
|
(try
|
||||||
(timers/schedule 100
|
(timers/schedule
|
||||||
#(let [svg-node (mf/ref-val svg-ref)
|
#(let [svg-node (mf/ref-val svg-ref)
|
||||||
canvas-node (mf/ref-val canvas-ref)
|
canvas-node (mf/ref-val canvas-ref)
|
||||||
canvas-context (.getContext canvas-node "2d")
|
canvas-context (.getContext canvas-node "2d")
|
||||||
|
|
Loading…
Add table
Reference in a new issue