Rendering alignment bug fixed (this shit needs a deep cleaning!)

master
Allen Webster 2019-10-06 01:01:52 -07:00
parent 5edbd93d26
commit 13e8c0aed4
1 changed files with 4 additions and 1 deletions

View File

@ -2855,6 +2855,9 @@ text_layout_region(Application_Links *app, Text_Layout_ID text_layout_id){
Text_Layout *layout = text_layout_get(&models->text_layouts, text_layout_id); Text_Layout *layout = text_layout_get(&models->text_layouts, text_layout_id);
if (layout != 0){ if (layout != 0){
result = layout->rect; result = layout->rect;
Vec2_f32 coordinate_center = models_get_coordinate_center(models);
result.p0 -= coordinate_center;
result.p1 -= coordinate_center;
} }
return(result); return(result);
} }
@ -2906,7 +2909,7 @@ text_layout_line_on_screen(Application_Links *app, Text_Layout_ID layout_id, i64
result.min = result.max; result.min = result.max;
} }
result -= layout->point.pixel_shift.y; result += rect.y0 - layout->point.pixel_shift.y;
result = range_intersect(result, rect_range_y(rect)); result = range_intersect(result, rect_range_y(rect));
Vec2_f32 coordinate_center = models_get_coordinate_center(models); Vec2_f32 coordinate_center = models_get_coordinate_center(models);
result -= coordinate_center.y; result -= coordinate_center.y;