respect cursor trail enabling in single line trail path

This commit is contained in:
Ryan Fleury
2025-11-07 13:40:24 -08:00
parent 0549f670c3
commit e4aae5b075
2 changed files with 15 additions and 9 deletions
+1
View File
@@ -4151,6 +4151,7 @@ rd_cell(RD_CellParams *params, String8 string)
draw_data->edited_string = push_str8_copy(ui_build_arena(), edit_string);
draw_data->cursor = params->cursor[0];
draw_data->mark = params->mark[0];
draw_data->trail = do_cursor_trail;
ui_box_equip_custom_draw(text_box, ui_line_edit_draw, draw_data);
Vec2F32 text2mouse = sub_2f32(ui_mouse(), ui_box_text_position(text_box));
FNT_Tag font = ui_top_font();
+5
View File
@@ -131,6 +131,7 @@ struct UI_LineEditDrawData
String8 edited_string;
TxtPt cursor;
TxtPt mark;
B32 trail;
};
internal UI_BOX_CUSTOM_DRAW(ui_line_edit_draw)
@@ -178,6 +179,8 @@ internal UI_BOX_CUSTOM_DRAW(ui_line_edit_draw)
Rng2F32 select_rect = union_2f32(cursor_rect, mark_rect);
dr_rect(select_rect, select_color, font_size/2.f, 0, 1.f);
dr_rect(cursor_rect, cursor_color, 0.f, 0, 0.f);
if(draw_data->trail)
{
R_Rect2DInst *trail_inst = dr_rect(trail_rect, trail_color, ui_top_font_size()*0.2f, 0, 1.f);
if(cursor_pixel_off > cursor_pixel_off__animated)
{
@@ -190,6 +193,7 @@ internal UI_BOX_CUSTOM_DRAW(ui_line_edit_draw)
trail_inst->colors[Corner_11].w *= 0.1f;
}
}
}
internal UI_Signal
ui_line_edit(TxtPt *cursor, TxtPt *mark, U8 *edit_buffer, U64 edit_buffer_size, U64 *edit_string_size_out, String8 pre_edit_value, String8 string)
@@ -288,6 +292,7 @@ ui_line_edit(TxtPt *cursor, TxtPt *mark, U8 *edit_buffer, U64 edit_buffer_size,
draw_data->edited_string = push_str8_copy(ui_build_arena(), edit_string);
draw_data->cursor = *cursor;
draw_data->mark = *mark;
draw_data->trail = 1;
ui_box_equip_display_string(editstr_box, edit_string);
ui_box_equip_custom_draw(editstr_box, ui_line_edit_draw, draw_data);
mouse_pt = txt_pt(1, 1+ui_box_char_pos_from_xy(editstr_box, ui_mouse()));