diff --git a/CHANGES.md b/CHANGES.md index 5fbaba21b..9a7b301e7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -33,6 +33,7 @@ - Fix undo on delete page does not preserve its order [Taiga #3375](https://tree.taiga.io/project/penpot/issue/3375) - Fix unexpected 404 on deleting library that is used by deleted files - Fix inconsistent message on deleting library when a library is linked from deleted files +- Fix change multiple colors with SVG [Taiga #3889](https://tree.taiga.io/project/penpot/issue/3889) ### :arrow_up: Deps updates ### :heart: Community contributions by (Thank you!) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/color_selection.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/color_selection.cljs index 7e1d74864..2f42d4065 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/color_selection.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/color_selection.cljs @@ -166,7 +166,17 @@ (dissoc :name) (dissoc :path) (d/without-nils)) - shapes-by-color (get @grouped-colors* old-color)] + + prev-color (-> @prev-color* + (dissoc :name) + (dissoc :path) + (d/without-nils)) + + ;; When dragging on the color picker sometimes all the shapes hasn't updated the color to the prev value so we need this extra calculation + shapes-by-old-color (get @grouped-colors* old-color) + shapes-by-prev-color (get @grouped-colors* prev-color) + shapes-by-color (or shapes-by-prev-color shapes-by-old-color)] + (reset! prev-color* new-color) (st/emit! (dc/change-color-in-selected new-color shapes-by-color old-color))))) on-open (mf/use-fn @@ -197,7 +207,7 @@ [:div.element-set-content [:div.selected-colors (for [[index color] (d/enumerate (take 3 library-colors))] - [:& color-row {:key (dm/str "color-" index) + [:& color-row {:key (dm/str "library-color-" index) :color color :index index :on-detach on-detach @@ -210,7 +220,7 @@ [:span.text (tr "workspace.options.more-lib-colors")]]) (when @expand-lib-color (for [[index color] (d/enumerate (drop 3 library-colors))] - [:& color-row {:key (dm/str "color-" index) + [:& color-row {:key (dm/str "library-color-" index) :color color :index index :on-detach on-detach