0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-23 06:58:58 -05:00

🐛 Fix change multiple colors with svg

This commit is contained in:
Alejandro Alonso 2022-09-20 11:20:38 +02:00
parent 978b309b04
commit 4de579f861
2 changed files with 14 additions and 3 deletions

View file

@ -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 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 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 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 ### :arrow_up: Deps updates
### :heart: Community contributions by (Thank you!) ### :heart: Community contributions by (Thank you!)

View file

@ -166,7 +166,17 @@
(dissoc :name) (dissoc :name)
(dissoc :path) (dissoc :path)
(d/without-nils)) (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))))) (st/emit! (dc/change-color-in-selected new-color shapes-by-color old-color)))))
on-open (mf/use-fn on-open (mf/use-fn
@ -197,7 +207,7 @@
[:div.element-set-content [:div.element-set-content
[:div.selected-colors [:div.selected-colors
(for [[index color] (d/enumerate (take 3 library-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 :color color
:index index :index index
:on-detach on-detach :on-detach on-detach
@ -210,7 +220,7 @@
[:span.text (tr "workspace.options.more-lib-colors")]]) [:span.text (tr "workspace.options.more-lib-colors")]])
(when @expand-lib-color (when @expand-lib-color
(for [[index color] (d/enumerate (drop 3 library-colors))] (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 :color color
:index index :index index
:on-detach on-detach :on-detach on-detach