🐛 Fix crash when removing multiple text fills

This commit is contained in:
alonso.torres 2024-04-12 12:41:55 +02:00
parent e636bdd0b0
commit cbac4587cf

View file

@ -69,33 +69,34 @@
on-add on-add
(mf/use-fn (mf/use-fn
(mf/deps ids) (mf/deps ids fills)
(fn [_] (fn [_]
(st/emit! (dc/add-fill ids {:color default-color (st/emit! (dc/add-fill ids {:color default-color
:opacity 1})) :opacity 1}))
(when (not (some? (seq fills))) (open-content)))) (when (or (= :multiple fills)
(not (some? (seq fills))))
(open-content))))
on-change on-change
(mf/use-fn (fn [index]
(mf/deps ids) (fn [color]
(fn [index] (st/emit! (dc/change-fill ids color index))))
(fn [color]
(st/emit! (dc/change-fill ids color index)))))
on-reorder on-reorder
(mf/use-fn (fn [new-index]
(mf/deps ids) (fn [index]
(fn [new-index] (st/emit! (dc/reorder-fills ids index new-index))))
(fn [index]
(st/emit! (dc/reorder-fills ids index new-index)))))
on-remove on-remove
(fn [index] (fn [index]
(fn [] (fn []
(st/emit! (dc/remove-fill ids {:color default-color (st/emit! (dc/remove-fill ids {:color default-color
:opacity 1} index)) :opacity 1} index))
(when (= 1 (count (seq fills))) (close-content)))) (when (or (= :multiple fills)
(= 1 (count (seq fills))))
(close-content))))
on-remove-all on-remove-all
(fn [_] (fn [_]
(st/emit! (dc/remove-all-fills ids {:color clr/black (st/emit! (dc/remove-all-fills ids {:color clr/black