mirror of
https://github.com/penpot/penpot.git
synced 2025-02-10 00:58:26 -05: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 []
|
||||
;; 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])]
|
||||
(st/emit!
|
||||
(if shift?
|
||||
|
|
|
@ -195,12 +195,12 @@
|
|||
:h h :s s :v v
|
||||
:hex hex)
|
||||
(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/deps 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.top-actions
|
||||
|
@ -397,18 +397,18 @@
|
|||
position (or position :left)
|
||||
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))
|
||||
(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
|
||||
(on-change new-value new-opacity op1 op2)))]
|
||||
(on-change new-value new-opacity id file-id shift-clicked?)))]
|
||||
|
||||
(mf/use-effect
|
||||
(fn []
|
||||
#(when (and @dirty? on-close)
|
||||
(when-let [[value opacity op1 op2] @last-change]
|
||||
(on-close value opacity op1 op2)))))
|
||||
(when-let [[value opacity id file-id] @last-change]
|
||||
(on-close value opacity id file-id)))))
|
||||
|
||||
[:div.colorpicker-tooltip
|
||||
{:style (clj->js style)}
|
||||
|
|
Loading…
Add table
Reference in a new issue