From 1ded4b2b28ab1b73d88ee67d692952da2b1bd622 Mon Sep 17 00:00:00 2001 From: Eva Date: Mon, 10 Jan 2022 09:31:10 +0100 Subject: [PATCH] :bug: Remove gradient if any when applyin solid color from library --- CHANGES.md | 1 + frontend/src/app/main/data/workspace/colors.cljs | 14 +++++++++++--- .../src/app/main/ui/workspace/sidebar/assets.cljs | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index ed14664e4e..54cc0c325e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -17,6 +17,7 @@ ### :bug: Bugs fixed +- Fix remove gradient if any when applying color from library [Taiga #2299](https://tree.taiga.io/project/penpot/issue/2299). - Fix Enter as key action to exit edit path [Taiga #2444](https://tree.taiga.io/project/penpot/issue/2444). - Fix add fill color from palette to groups and components [Taiga #2313](https://tree.taiga.io/project/penpot/issue/2313). - Fix default project name in all languages [Taiga #2280](https://tree.taiga.io/project/penpot/issue/2280). diff --git a/frontend/src/app/main/data/workspace/colors.cljs b/frontend/src/app/main/data/workspace/colors.cljs index 9188e65235..92ad458959 100644 --- a/frontend/src/app/main/data/workspace/colors.cljs +++ b/frontend/src/app/main/data/workspace/colors.cljs @@ -123,7 +123,11 @@ text-ids (filter is-text? ids) shape-ids (filter (comp not is-text?) ids) - attrs (cond-> {} + attrs (cond-> {:fill-color nil + :fill-color-gradient nil + ::fill-color-ref-file nil + :fill-color-ref-id nil + :fill-opacity nil} (contains? color :color) (assoc :fill-color (:color color)) @@ -138,7 +142,7 @@ (contains? color :opacity) (assoc :fill-opacity (:opacity color)))] - + (rx/concat (rx/from (map #(dwt/update-text-attrs {:id % :attrs attrs}) text-ids)) (rx/of (dch/update-shapes shape-ids (fn [shape] (d/merge shape attrs))))))))) @@ -148,7 +152,11 @@ (ptk/reify ::change-stroke ptk/WatchEvent (watch [_ _ _] - (let [attrs (cond-> {} + (let [attrs (cond-> {:stroke-color nil + :stroke-color-ref-id nil + :stroke-color-ref-file nil + :stroke-color-gradient nil + :stroke-opacity nil} (contains? color :color) (assoc :stroke-color (:color color)) diff --git a/frontend/src/app/main/ui/workspace/sidebar/assets.cljs b/frontend/src/app/main/ui/workspace/sidebar/assets.cljs index 8e701404e3..3a4cc69a14 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/assets.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/assets.cljs @@ -797,7 +797,7 @@ apply-color (fn [_ event] (let [ids (wsh/lookup-selected @st/state)] - (if (kbd/shift? event) + (if (kbd/alt? event) (st/emit! (dc/change-stroke ids color)) (st/emit! (dc/change-fill ids color)))))