🐛 Fix changing properties resizes the text box height

This commit is contained in:
Alejandro Alonso 2025-11-07 11:52:53 +01:00 committed by Alonso Torres
parent ec0dc2931c
commit a11b0f54d7

View File

@ -56,16 +56,19 @@
([shape] ([shape]
(resize-wasm-text-modifiers shape (:content shape))) (resize-wasm-text-modifiers shape (:content shape)))
([{:keys [id points selrect] :as shape} content] ([{:keys [id points selrect grow-type] :as shape} content]
(wasm.api/use-shape id) (wasm.api/use-shape id)
(wasm.api/set-shape-text-content id content) (wasm.api/set-shape-text-content id content)
(wasm.api/set-shape-text-images id content) (wasm.api/set-shape-text-images id content)
(let [dimension (wasm.api/get-text-dimensions) (let [dimension (wasm.api/get-text-dimensions)
resize-v (gpt/point width-scale (if (#{:fixed :auto-height} grow-type)
(/ (:width dimension) (-> selrect :width)) 1.0
(/ (:height dimension) (-> selrect :height))) (/ (:width dimension) (:width selrect)))
height-scale (if (= :fixed grow-type)
1.0
(/ (:height dimension) (:height selrect)))
resize-v (gpt/point width-scale height-scale)
origin (first points)] origin (first points)]
{id {id