@@ -131,6 +131,7 @@ struct UI_LineEditDrawData
131131 String8 edited_string ;
132132 TxtPt cursor ;
133133 TxtPt mark ;
134+ B32 trail ;
134135};
135136
136137internal UI_BOX_CUSTOM_DRAW (ui_line_edit_draw )
@@ -178,16 +179,19 @@ internal UI_BOX_CUSTOM_DRAW(ui_line_edit_draw)
178179 Rng2F32 select_rect = union_2f32 (cursor_rect , mark_rect );
179180 dr_rect (select_rect , select_color , font_size /2.f , 0 , 1.f );
180181 dr_rect (cursor_rect , cursor_color , 0.f , 0 , 0.f );
181- R_Rect2DInst * trail_inst = dr_rect (trail_rect , trail_color , ui_top_font_size ()* 0.2f , 0 , 1.f );
182- if (cursor_pixel_off > cursor_pixel_off__animated )
182+ if (draw_data -> trail )
183183 {
184- trail_inst -> colors [Corner_00 ].w *= 0.1f ;
185- trail_inst -> colors [Corner_01 ].w *= 0.1f ;
186- }
187- else
188- {
189- trail_inst -> colors [Corner_10 ].w *= 0.1f ;
190- trail_inst -> colors [Corner_11 ].w *= 0.1f ;
184+ R_Rect2DInst * trail_inst = dr_rect (trail_rect , trail_color , ui_top_font_size ()* 0.2f , 0 , 1.f );
185+ if (cursor_pixel_off > cursor_pixel_off__animated )
186+ {
187+ trail_inst -> colors [Corner_00 ].w *= 0.1f ;
188+ trail_inst -> colors [Corner_01 ].w *= 0.1f ;
189+ }
190+ else
191+ {
192+ trail_inst -> colors [Corner_10 ].w *= 0.1f ;
193+ trail_inst -> colors [Corner_11 ].w *= 0.1f ;
194+ }
191195 }
192196}
193197
@@ -288,6 +292,7 @@ ui_line_edit(TxtPt *cursor, TxtPt *mark, U8 *edit_buffer, U64 edit_buffer_size,
288292 draw_data -> edited_string = push_str8_copy (ui_build_arena (), edit_string );
289293 draw_data -> cursor = * cursor ;
290294 draw_data -> mark = * mark ;
295+ draw_data -> trail = 1 ;
291296 ui_box_equip_display_string (editstr_box , edit_string );
292297 ui_box_equip_custom_draw (editstr_box , ui_line_edit_draw , draw_data );
293298 mouse_pt = txt_pt (1 , 1 + ui_box_char_pos_from_xy (editstr_box , ui_mouse ()));
0 commit comments