mirror of
https://github.com/penpot/penpot.git
synced 2025-12-12 06:24:17 +01:00
🐛 Fix text editor vertical align
This commit is contained in:
committed by
Alonso Torres
parent
54451608dc
commit
60e32bbc71
@@ -313,15 +313,17 @@
|
||||
(let [{:keys [height]} (wasm.api/get-text-dimensions shape-id)
|
||||
selrect-transform (mf/deref refs/workspace-selrect)
|
||||
[selrect transform] (dsh/get-selrect selrect-transform shape)
|
||||
|
||||
selrect-height (:height selrect)
|
||||
max-height (max height selrect-height)
|
||||
valign (-> shape :content :vertical-align)
|
||||
|
||||
y (:y selrect)
|
||||
y (case valign
|
||||
"bottom" (- y (- height (:height selrect)))
|
||||
"center" (- y (/ (- height (:height selrect)) 2))
|
||||
y (if (> height selrect-height)
|
||||
(case valign
|
||||
"bottom" (- y (- height selrect-height))
|
||||
"center" (- y (/ (- height selrect-height) 2))
|
||||
"top" y)
|
||||
y)]
|
||||
[(assoc selrect :y y :width (:width selrect) :height (max height (:height selrect))) transform])
|
||||
[(assoc selrect :y y :width (:width selrect) :height max-height) transform])
|
||||
|
||||
(let [bounds (gst/shape->rect shape)
|
||||
x (mth/min (dm/get-prop bounds :x)
|
||||
|
||||
Reference in New Issue
Block a user