feat(ui): text-fit, line-height, and ems against the font size an element ends with
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d163bad406
commit
355201f094
16 changed files with 149 additions and 21 deletions
|
|
@ -2,11 +2,13 @@
|
|||
# normal), breaking between words; nowrap keeps one line, and text-overflow: ellipsis cuts it
|
||||
function ly_measure_text(n: UiNode, avail: float) -> void {
|
||||
n.lines = null
|
||||
let lh = n.rsize * 1.25
|
||||
let one = ly_text_w(n.text, n.rsize)
|
||||
let lh = ly_line_h(n)
|
||||
var one = ly_text_w(n.text, n.rsize)
|
||||
var room = avail - n.ml - n.mr - ly_hin(n)
|
||||
if n.w >= 0.0 { room = n.w - ly_hin(n) }
|
||||
if n.nowrap or room <= 0.0 or one <= room {
|
||||
let fits = n.ex != null and n.ex.fit_min > 0.0
|
||||
if fits and room > 0.0 { one = Math.min(one, room) }
|
||||
if n.nowrap or fits or room <= 0.0 or one <= room {
|
||||
n.mw = n.mw + one
|
||||
n.mh = n.mh + lh
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue