From 391ba77da96c019e6be1eba54461a25e3aeefbbd Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Mon, 27 Mar 2023 10:58:25 +0200 Subject: [PATCH] :bug: Fix scaling of texts --- common/src/app/common/types/modifiers.cljc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/common/src/app/common/types/modifiers.cljc b/common/src/app/common/types/modifiers.cljc index 6c3b3acde..7ce687cad 100644 --- a/common/src/app/common/types/modifiers.cljc +++ b/common/src/app/common/types/modifiers.cljc @@ -645,12 +645,16 @@ (recur matrix (next modifiers))))))) (defn transform-text-node [value attrs] - (let [font-size (-> (get attrs :font-size 14) - (d/parse-double) - (* value) - (str))] + (let [font-size (-> (get attrs :font-size 14) d/parse-double (* value) str) + letter-spacing (-> (get attrs :letter-spacing 0) d/parse-double (* value) str)] + (d/txt-merge attrs {:font-size font-size + :letter-spacing letter-spacing}))) + +(defn transform-paragraph-node [value attrs] + (let [font-size (-> (get attrs :font-size 14) d/parse-double (* value) str)] (d/txt-merge attrs {:font-size font-size}))) + (defn update-text-content [shape scale-text-content value] (update shape :content scale-text-content value)) @@ -661,9 +665,8 @@ (letfn [(scale-text-content [content value] (->> content - (txt/transform-nodes - txt/is-text-node? - (partial transform-text-node value)))) + (txt/transform-nodes txt/is-text-node? (partial transform-text-node value)) + (txt/transform-nodes txt/is-paragraph-node? (partial transform-paragraph-node value)))) (apply-scale-content [shape value]