mirror of
https://github.com/penpot/penpot.git
synced 2025-07-16 23:35:14 +02:00
🐛 Fix text out of borders with "auto width" and center align
This commit is contained in:
parent
08a5550547
commit
0a529943a2
2 changed files with 6 additions and 9 deletions
|
@ -189,16 +189,12 @@
|
|||
(some? editor-state)
|
||||
(update-with-editor-state editor-state))
|
||||
|
||||
;; When we have a text with grow-type :auto-height we need to check the correct height
|
||||
;; When we have a text with grow-type :auto-height or :auto-height we need to check the correct height
|
||||
;; otherwise the center alignment will break
|
||||
shape
|
||||
(if (or (not= :auto-height (:grow-type shape)) (empty? text-modifier))
|
||||
shape
|
||||
(let [tr-shape (dwt/apply-text-modifier shape text-modifier)]
|
||||
(cond-> shape
|
||||
;; we only change the height otherwise could cause problems with the other fields
|
||||
(some? text-modifier)
|
||||
(assoc :height (:height tr-shape)))))
|
||||
tr-shape (when text-modifier (dwt/apply-text-modifier shape text-modifier))
|
||||
shape (cond-> shape
|
||||
(and (some? text-modifier) (#{:auto-height :auto-width} (:grow-type shape)))
|
||||
(assoc :width (:width tr-shape) :height (:height tr-shape)))
|
||||
|
||||
shape (hooks/use-equal-memo shape)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue