🐛 Fix what happens when user click on an fill image recent color

This commit is contained in:
Alejandro Alonso 2023-11-22 14:38:49 +01:00 committed by Andrey Antukh
parent 0528c26b5e
commit aca5289b21

View file

@ -172,7 +172,12 @@
(cond-> (= index 0) (assoc :stops [(clean-stop old-stops 0 color) (nth old-stops 1)])) (cond-> (= index 0) (assoc :stops [(clean-stop old-stops 0 color) (nth old-stops 1)]))
(cond-> (= index 1) (assoc :stops [(nth old-stops 0) (clean-stop old-stops 1 color)])) (cond-> (= index 1) (assoc :stops [(nth old-stops 0) (clean-stop old-stops 1 color)]))
(dissoc :shape-id))] (dissoc :shape-id))]
(change-to {:gradient new-gradient})))] (change-to {:gradient new-gradient})))
new-mode (cond
(:image color) :image
(:color color) :color
(= :linear (get-in color [:gradient :type])) :linear-gradient
(= :radial (get-in color [:gradient :type])) :radial-gradient)]
;; If we have any kind of gradient and: ;; If we have any kind of gradient and:
;; Click on a solid color -> This color is applied to the selected offset ;; Click on a solid color -> This color is applied to the selected offset
;; Click on a color with transparency -> The same to solid color will happend ;; Click on a color with transparency -> The same to solid color will happend
@ -183,7 +188,8 @@
(if is-gradient? (if is-gradient?
(change-to color) (change-to color)
(set-new-gradient state color editig-stop-origin)) (set-new-gradient state color editig-stop-origin))
(change-to color))))) (change-to color))
(handle-change-mode new-mode))))
on-add-library-color on-add-library-color
(mf/use-fn (mf/use-fn