From d449abc7cab08b95b5c7a79509724c9e3f6e764e Mon Sep 17 00:00:00 2001 From: jacob Date: Wed, 31 Dec 2025 14:11:46 -0600 Subject: [PATCH] fix baseline length truncation false positives --- src/ui/ui_core.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ui/ui_core.c b/src/ui/ui_core.c index ec68ecce..8360bd39 100644 --- a/src/ui/ui_core.c +++ b/src/ui/ui_core.c @@ -1121,11 +1121,11 @@ void UI_EndFrame(UI_Frame *frame) { box->solved_scale = MulVec2Vec2(parent->solved_scale, box->solved_scale); } - if (AbsF32(1.0 - box->solved_scale.x) < 0.001) + if (AbsF32(1.0 - box->solved_scale.x) < 0.0025) { box->solved_scale.x = 1; } - if (AbsF32(1.0 - box->solved_scale.y) < 0.001) + if (AbsF32(1.0 - box->solved_scale.y) < 0.0025) { box->solved_scale.y = 1; } @@ -1526,9 +1526,9 @@ void UI_EndFrame(UI_Frame *frame) UI_RegionPair child_alignment = UI_PairFromRegion(box->desc.child_alignment); b32 is_visible = 1; - is_visible = is_visible && (box->desc.tint.w >= 0.005); - is_visible = is_visible && (box->screen_rect.p1.x - box->screen_rect.p0.x > 0.001); - is_visible = is_visible && (box->screen_rect.p1.y - box->screen_rect.p0.y > 0.001); + is_visible = is_visible && (box->desc.tint.w >= 0.0025); + is_visible = is_visible && (box->screen_rect.p1.x - box->screen_rect.p0.x > 0.0025); + is_visible = is_visible && (box->screen_rect.p1.y - box->screen_rect.p0.y > 0.0025); if (is_visible || AnyBit(frame->frame_flags, UI_FrameFlag_Debug)) { Vec4 debug_lin = is_visible ? LinearFromSrgb(box->desc.debug_color) : LinearFromSrgb(box->desc.invisible_debug_color); @@ -1556,7 +1556,7 @@ void UI_EndFrame(UI_Frame *frame) if (AnyBit(box->desc.flags, UI_BoxFlag_DrawText) && raw_run.ready) { f32 max_baseline = CeilF32(DimsFromRng2(box->screen_rect).x); - b32 should_truncate = raw_run.baseline_length > max_baseline && !AnyBit(box->desc.flags, UI_BoxFlag_NoTextTruncation); + b32 should_truncate = FloorF32(raw_run.baseline_length) > max_baseline && !AnyBit(box->desc.flags, UI_BoxFlag_NoTextTruncation); // Truncate run u64 final_rects_count = 0;