mirror of
https://github.com/penpot/penpot.git
synced 2025-05-24 06:27:20 +02:00
🐛 Fixes problem with picker data
This commit is contained in:
parent
d0f403e7df
commit
432a139f35
2 changed files with 8 additions and 8 deletions
|
@ -219,7 +219,7 @@
|
||||||
|
|
||||||
(defn picker-for-selected-shape []
|
(defn picker-for-selected-shape []
|
||||||
;; TODO: replace st/emit! by a subject push and set that in the WatchEvent
|
;; TODO: replace st/emit! by a subject push and set that in the WatchEvent
|
||||||
(let [handle-change-color (fn [color _ shift?]
|
(let [handle-change-color (fn [color opacity id file-id shift?]
|
||||||
(let [ids (get-in @st/state [:workspace-local :selected])]
|
(let [ids (get-in @st/state [:workspace-local :selected])]
|
||||||
(st/emit!
|
(st/emit!
|
||||||
(if shift?
|
(if shift?
|
||||||
|
|
|
@ -195,12 +195,12 @@
|
||||||
:h h :s s :v v
|
:h h :s s :v v
|
||||||
:hex hex)
|
:hex hex)
|
||||||
(when picked-color-select
|
(when picked-color-select
|
||||||
(on-change hex (:alpha @current-color) picked-shift?))))))
|
(on-change hex (:alpha @current-color) nil nil picked-shift?))))))
|
||||||
|
|
||||||
(mf/use-effect
|
(mf/use-effect
|
||||||
(mf/deps picking-color? picked-color-select)
|
(mf/deps picking-color? picked-color-select)
|
||||||
(fn [] (when (and picking-color? picked-color-select)
|
(fn [] (when (and picking-color? picked-color-select)
|
||||||
(on-change (:hex @current-color) (:alpha @current-color) picked-shift?))))
|
(on-change (:hex @current-color) (:alpha @current-color) nil nil picked-shift?))))
|
||||||
|
|
||||||
[:div.colorpicker {:ref ref-picker}
|
[:div.colorpicker {:ref ref-picker}
|
||||||
[:div.top-actions
|
[:div.top-actions
|
||||||
|
@ -397,18 +397,18 @@
|
||||||
position (or position :left)
|
position (or position :left)
|
||||||
style (calculate-position vport position x y)
|
style (calculate-position vport position x y)
|
||||||
|
|
||||||
handle-change (fn [new-value new-opacity op1 op2]
|
handle-change (fn [new-value new-opacity id file-id shift-clicked?]
|
||||||
(when (or (not= new-value value) (not= new-opacity opacity))
|
(when (or (not= new-value value) (not= new-opacity opacity))
|
||||||
(reset! dirty? true))
|
(reset! dirty? true))
|
||||||
(reset! last-change [new-value new-opacity op1 op2])
|
(reset! last-change [new-value new-opacity id file-id])
|
||||||
(when on-change
|
(when on-change
|
||||||
(on-change new-value new-opacity op1 op2)))]
|
(on-change new-value new-opacity id file-id shift-clicked?)))]
|
||||||
|
|
||||||
(mf/use-effect
|
(mf/use-effect
|
||||||
(fn []
|
(fn []
|
||||||
#(when (and @dirty? on-close)
|
#(when (and @dirty? on-close)
|
||||||
(when-let [[value opacity op1 op2] @last-change]
|
(when-let [[value opacity id file-id] @last-change]
|
||||||
(on-close value opacity op1 op2)))))
|
(on-close value opacity id file-id)))))
|
||||||
|
|
||||||
[:div.colorpicker-tooltip
|
[:div.colorpicker-tooltip
|
||||||
{:style (clj->js style)}
|
{:style (clj->js style)}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue