mirror of
https://github.com/penpot/penpot.git
synced 2025-03-11 23:31:21 -05:00
🐛 Fix scaling of texts
This commit is contained in:
parent
1d7b43ffbc
commit
391ba77da9
1 changed files with 10 additions and 7 deletions
|
@ -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]
|
||||
|
|
Loading…
Add table
Reference in a new issue