mirror of
https://github.com/penpot/penpot.git
synced 2026-08-01 19:06:18 +00:00
Merge pull request #7972 from penpot/niwinz-staging-bugfix-7
🐛 Fix exception on assinging gradient to shadow on multiple selection
This commit is contained in:
commit
f67f1a6a0e
@ -14,7 +14,7 @@
|
|||||||
[app.common.types.fills :as types.fills]
|
[app.common.types.fills :as types.fills]
|
||||||
[app.common.types.library :as ctl]
|
[app.common.types.library :as ctl]
|
||||||
[app.common.types.shape :as shp]
|
[app.common.types.shape :as shp]
|
||||||
[app.common.types.shape.shadow :refer [check-shadow]]
|
[app.common.types.shape.shadow :as types.shadow]
|
||||||
[app.common.types.text :as txt]
|
[app.common.types.text :as txt]
|
||||||
[app.main.broadcast :as mbc]
|
[app.main.broadcast :as mbc]
|
||||||
[app.main.data.helpers :as dsh]
|
[app.main.data.helpers :as dsh]
|
||||||
@ -406,30 +406,30 @@
|
|||||||
|
|
||||||
(defn change-shadow
|
(defn change-shadow
|
||||||
[ids attrs index]
|
[ids attrs index]
|
||||||
(ptk/reify ::change-shadow
|
(letfn [(update-shadow [shape]
|
||||||
ptk/WatchEvent
|
(let [;; If we try to set a gradient to a shadow (for
|
||||||
(watch [_ _ _]
|
;; example using the color selection from
|
||||||
(rx/of (dwsh/update-shapes
|
;; multiple shapes) let's use the first stop
|
||||||
ids
|
;; color
|
||||||
(fn [shape]
|
attrs (cond-> attrs
|
||||||
(let [;; If we try to set a gradient to a shadow (for
|
(:gradient attrs)
|
||||||
;; example using the color selection from
|
(-> (dm/get-in [:gradient :stops 0])
|
||||||
;; multiple shapes) let's use the first stop
|
(select-keys types.shadow/color-attrs)))
|
||||||
;; color
|
|
||||||
attrs (cond-> attrs
|
|
||||||
(:gradient attrs)
|
|
||||||
(dm/get-in [:gradient :stops 0]))
|
|
||||||
|
|
||||||
attrs' (-> (dm/get-in shape [:shadow index :color])
|
attrs' (-> (dm/get-in shape [:shadow index :color])
|
||||||
(merge attrs)
|
(merge attrs)
|
||||||
(d/without-nils))]
|
(d/without-nils))]
|
||||||
(assoc-in shape [:shadow index :color] attrs'))))))))
|
(assoc-in shape [:shadow index :color] attrs')))]
|
||||||
|
(ptk/reify ::change-shadow
|
||||||
|
ptk/WatchEvent
|
||||||
|
(watch [_ _ _]
|
||||||
|
(rx/of (dwsh/update-shapes ids update-shadow))))))
|
||||||
|
|
||||||
(defn add-shadow
|
(defn add-shadow
|
||||||
[ids shadow]
|
[ids shadow]
|
||||||
|
|
||||||
(assert
|
(assert
|
||||||
(check-shadow shadow)
|
(types.shadow/check-shadow shadow)
|
||||||
"expected a valid shadow struct")
|
"expected a valid shadow struct")
|
||||||
|
|
||||||
(assert
|
(assert
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user