mirror of
https://github.com/penpot/penpot.git
synced 2025-06-14 00:41:40 +02:00
:fix: Problem with opacity fill
This commit is contained in:
parent
0f5ce3b836
commit
50ef7a8c73
2 changed files with 27 additions and 23 deletions
|
@ -166,31 +166,35 @@
|
||||||
(assoc-in [:workspace-local :picked-shift?] shift?)))))
|
(assoc-in [:workspace-local :picked-shift?] shift?)))))
|
||||||
|
|
||||||
|
|
||||||
(defn change-fill [ids color id file-id]
|
(defn change-fill
|
||||||
(ptk/reify ::change-fill
|
([ids color id file-id]
|
||||||
ptk/WatchEvent
|
(change-fill ids color 1 id file-id))
|
||||||
(watch [_ state s]
|
([ids color opacity id file-id]
|
||||||
(let [pid (:current-page-id state)
|
(ptk/reify ::change-fill
|
||||||
objects (get-in state [:workspace-data :pages-index pid :objects])
|
ptk/WatchEvent
|
||||||
children (mapcat #(cph/get-children % objects) ids)
|
(watch [_ state s]
|
||||||
ids (into ids children)
|
(let [pid (:current-page-id state)
|
||||||
|
objects (get-in state [:workspace-data :pages-index pid :objects])
|
||||||
|
children (mapcat #(cph/get-children % objects) ids)
|
||||||
|
ids (into ids children)
|
||||||
|
|
||||||
is-text? #(= :text (:type (get objects %)))
|
is-text? #(= :text (:type (get objects %)))
|
||||||
text-ids (filter is-text? ids)
|
text-ids (filter is-text? ids)
|
||||||
shape-ids (filter (comp not is-text?) ids)
|
shape-ids (filter (comp not is-text?) ids)
|
||||||
update-fn (fn [shape] (assoc shape
|
update-fn (fn [shape] (assoc shape
|
||||||
:fill-color color
|
:fill-color color
|
||||||
:fill-color-ref-id id
|
:fill-opacity opacity
|
||||||
:fill-color-ref-file file-id))
|
:fill-color-ref-id id
|
||||||
editor (get-in state [:workspace-local :editor])
|
:fill-color-ref-file file-id))
|
||||||
converted-attrs {:fill color}
|
editor (get-in state [:workspace-local :editor])
|
||||||
|
converted-attrs {:fill color}
|
||||||
|
|
||||||
reduce-fn (fn [state id]
|
reduce-fn (fn [state id]
|
||||||
(update-in state [:workspace-data :pages-index pid :objects id] update-fn))]
|
(update-in state [:workspace-data :pages-index pid :objects id] update-fn))]
|
||||||
|
|
||||||
(rx/from (conj
|
(rx/from (conj
|
||||||
(map #(dwt/update-text-attrs {:id % :editor editor :attrs converted-attrs}) text-ids)
|
(map #(dwt/update-text-attrs {:id % :editor editor :attrs converted-attrs}) text-ids)
|
||||||
(dwc/update-shapes shape-ids update-fn)))))))
|
(dwc/update-shapes shape-ids update-fn))))))))
|
||||||
|
|
||||||
(defn change-stroke [ids color id file-id]
|
(defn change-stroke [ids color id file-id]
|
||||||
(ptk/reify ::change-stroke
|
(ptk/reify ::change-stroke
|
||||||
|
|
|
@ -71,7 +71,7 @@
|
||||||
(mf/use-callback
|
(mf/use-callback
|
||||||
(mf/deps ids)
|
(mf/deps ids)
|
||||||
(fn [value opacity id file-id]
|
(fn [value opacity id file-id]
|
||||||
(st/emit! (dc/change-fill ids value id file-id))))
|
(st/emit! (dc/change-fill ids value opacity id file-id))))
|
||||||
|
|
||||||
on-open-picker
|
on-open-picker
|
||||||
(mf/use-callback
|
(mf/use-callback
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue