fix baseline length truncation false positives

This commit is contained in:
jacob 2025-12-31 14:11:46 -06:00
parent 4689be8dc7
commit d449abc7ca

View File

@ -1121,11 +1121,11 @@ void UI_EndFrame(UI_Frame *frame)
{ {
box->solved_scale = MulVec2Vec2(parent->solved_scale, box->solved_scale); 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; 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; 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); UI_RegionPair child_alignment = UI_PairFromRegion(box->desc.child_alignment);
b32 is_visible = 1; b32 is_visible = 1;
is_visible = is_visible && (box->desc.tint.w >= 0.005); 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.001); 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.001); 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)) 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); 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) if (AnyBit(box->desc.flags, UI_BoxFlag_DrawText) && raw_run.ready)
{ {
f32 max_baseline = CeilF32(DimsFromRng2(box->screen_rect).x); 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 // Truncate run
u64 final_rects_count = 0; u64 final_rects_count = 0;