mirror of
https://github.com/penpot/penpot.git
synced 2025-02-15 11:38:24 -05:00
🐛 Fix apply color to groups from assets panel
This commit is contained in:
parent
15a26d10f0
commit
18afb701fb
1 changed files with 15 additions and 3 deletions
|
@ -33,6 +33,7 @@
|
|||
[app.main.ui.context :as ctx]
|
||||
[app.main.ui.icons :as i]
|
||||
[app.main.ui.workspace.sidebar.options.menus.typography :refer [typography-entry]]
|
||||
[app.util.color :as uc]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.dom.dnd :as dnd]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
|
@ -802,10 +803,21 @@
|
|||
;; TODO: looks like the first argument is not necessary
|
||||
apply-color
|
||||
(fn [_ event]
|
||||
(let [ids (wsh/lookup-selected @st/state)]
|
||||
(let [objects (wsh/lookup-page-objects @st/state)
|
||||
selected (->> (wsh/lookup-selected @st/state)
|
||||
(cph/clean-loops objects))
|
||||
selected-obj (keep (d/getf objects) selected)
|
||||
select-shapes-for-color (fn [shape objects]
|
||||
(let [shapes (case (:type shape)
|
||||
:group (cph/get-children objects (:id shape))
|
||||
[shape])]
|
||||
(->> shapes
|
||||
(remove cph/group-shape?)
|
||||
(map :id))))
|
||||
ids (mapcat #(select-shapes-for-color % objects) selected-obj)]
|
||||
(if (kbd/alt? event)
|
||||
(st/emit! (dc/change-stroke ids color 0))
|
||||
(st/emit! (dc/change-fill ids color 0)))))
|
||||
(st/emit! (dc/change-stroke ids (merge uc/empty-color color) 0))
|
||||
(st/emit! (dc/change-fill ids (merge uc/empty-color color) 0)))))
|
||||
|
||||
rename-color
|
||||
(fn [name]
|
||||
|
|
Loading…
Add table
Reference in a new issue