0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-12 07:41:43 -05:00

🐛 Fix scaling of texts

This commit is contained in:
alonso.torres 2023-03-27 10:58:25 +02:00
parent 1d7b43ffbc
commit 391ba77da9

View file

@ -645,12 +645,16 @@
(recur matrix (next modifiers))))))) (recur matrix (next modifiers)))))))
(defn transform-text-node [value attrs] (defn transform-text-node [value attrs]
(let [font-size (-> (get attrs :font-size 14) (let [font-size (-> (get attrs :font-size 14) d/parse-double (* value) str)
(d/parse-double) letter-spacing (-> (get attrs :letter-spacing 0) d/parse-double (* value) str)]
(* value) (d/txt-merge attrs {:font-size font-size
(str))] :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}))) (d/txt-merge attrs {:font-size font-size})))
(defn update-text-content (defn update-text-content
[shape scale-text-content value] [shape scale-text-content value]
(update shape :content scale-text-content value)) (update shape :content scale-text-content value))
@ -661,9 +665,8 @@
(letfn [(scale-text-content (letfn [(scale-text-content
[content value] [content value]
(->> content (->> content
(txt/transform-nodes (txt/transform-nodes txt/is-text-node? (partial transform-text-node value))
txt/is-text-node? (txt/transform-nodes txt/is-paragraph-node? (partial transform-paragraph-node value))))
(partial transform-text-node value))))
(apply-scale-content (apply-scale-content
[shape value] [shape value]