@@ -7,7 +7,7 @@ use re_types::{
7
7
archetypes:: Pinhole , blueprint:: components:: VisualBounds2D , components:: ViewCoordinates ,
8
8
image:: ImageKind ,
9
9
} ;
10
- use re_ui:: UiExt as _;
10
+ use re_ui:: { ContextExt as _ , UiExt as _} ;
11
11
use re_viewer_context:: {
12
12
HoverHighlight , SelectionHighlight , SpaceViewHighlights , SpaceViewState , ViewerContext ,
13
13
} ;
@@ -18,7 +18,7 @@ use crate::{
18
18
picking:: { PickableUiRect , PickingResult } ,
19
19
scene_bounding_boxes:: SceneBoundingBoxes ,
20
20
view_kind:: SpatialSpaceViewKind ,
21
- visualizers:: { SpatialViewVisualizerData , UiLabel , UiLabelTarget } ,
21
+ visualizers:: { SpatialViewVisualizerData , UiLabel , UiLabelStyle , UiLabelTarget } ,
22
22
} ;
23
23
24
24
use super :: { eye:: Eye , ui_3d:: View3DState } ;
@@ -214,13 +214,19 @@ pub fn create_labels(
214
214
} ;
215
215
216
216
let font_id = egui:: TextStyle :: Body . resolve ( parent_ui. style ( ) ) ;
217
+ let format = match label. style {
218
+ UiLabelStyle :: Color ( color) => egui:: TextFormat :: simple ( font_id, color) ,
219
+ UiLabelStyle :: Error => parent_ui. ctx ( ) . error_text_format ( ) ,
220
+ } ;
221
+ let text_color = format. color ;
222
+
217
223
let galley = parent_ui. fonts ( |fonts| {
218
224
fonts. layout_job ( {
219
225
egui:: text:: LayoutJob {
220
226
sections : vec ! [ egui:: text:: LayoutSection {
221
227
leading_space: 0.0 ,
222
228
byte_range: 0 ..label. text. len( ) ,
223
- format: egui :: TextFormat :: simple ( font_id , label . color ) ,
229
+ format,
224
230
} ] ,
225
231
text : label. text . clone ( ) ,
226
232
wrap : TextWrapping {
@@ -241,9 +247,9 @@ pub fn create_labels(
241
247
let highlight = highlights
242
248
. entity_highlight ( label. labeled_instance . entity_path_hash )
243
249
. index_highlight ( label. labeled_instance . instance ) ;
244
- let fill_color = match highlight. hover {
250
+ let background_color = match highlight. hover {
245
251
HoverHighlight :: None => match highlight. selection {
246
- SelectionHighlight :: None => parent_ui. style ( ) . visuals . widgets . inactive . bg_fill ,
252
+ SelectionHighlight :: None => parent_ui. style ( ) . visuals . panel_fill ,
247
253
SelectionHighlight :: SiblingSelection => {
248
254
parent_ui. style ( ) . visuals . widgets . active . bg_fill
249
255
}
@@ -252,11 +258,11 @@ pub fn create_labels(
252
258
HoverHighlight :: Hovered => parent_ui. style ( ) . visuals . widgets . hovered . bg_fill ,
253
259
} ;
254
260
255
- label_shapes. push ( egui:: Shape :: rect_filled ( bg_rect, 3.0 , fill_color ) ) ;
261
+ label_shapes. push ( egui:: Shape :: rect_filled ( bg_rect, 3.0 , background_color ) ) ;
256
262
label_shapes. push ( egui:: Shape :: galley (
257
263
text_rect. center_top ( ) ,
258
264
galley,
259
- label . color ,
265
+ text_color ,
260
266
) ) ;
261
267
262
268
ui_rects. push ( PickableUiRect {
0 commit comments