@@ -739,9 +739,6 @@ pub fn extract_text_sections(
739
739
let transform = global_transform. affine ( )
740
740
* bevy_math:: Affine3A :: from_translation ( ( -0.5 * uinode. size ( ) ) . extend ( 0. ) ) ;
741
741
742
- let mut color = LinearRgba :: WHITE ;
743
- let mut current_span = usize:: MAX ;
744
-
745
742
for (
746
743
i,
747
744
PositionedGlyph {
@@ -752,20 +749,6 @@ pub fn extract_text_sections(
752
749
} ,
753
750
) in text_layout_info. glyphs . iter ( ) . enumerate ( )
754
751
{
755
- if * span_index != current_span {
756
- color = text_styles
757
- . get (
758
- computed_block
759
- . entities ( )
760
- . get ( * span_index)
761
- . map ( |t| t. entity )
762
- . unwrap_or ( Entity :: PLACEHOLDER ) ,
763
- )
764
- . map ( |text_color| LinearRgba :: from ( text_color. 0 ) )
765
- . unwrap_or_default ( ) ;
766
- current_span = * span_index;
767
- }
768
-
769
752
let rect = texture_atlases
770
753
. get ( & atlas_info. texture_atlas )
771
754
. unwrap ( )
@@ -777,8 +760,18 @@ pub fn extract_text_sections(
777
760
} ) ;
778
761
779
762
if text_layout_info. glyphs . get ( i + 1 ) . is_none_or ( |info| {
780
- info. span_index != current_span || info. atlas_info . texture != atlas_info. texture
763
+ info. span_index != * span_index || info. atlas_info . texture != atlas_info. texture
781
764
} ) {
765
+ let color = text_styles
766
+ . get (
767
+ computed_block
768
+ . entities ( )
769
+ . get ( * span_index)
770
+ . map ( |t| t. entity )
771
+ . unwrap_or ( Entity :: PLACEHOLDER ) ,
772
+ )
773
+ . map ( |text_color| LinearRgba :: from ( text_color. 0 ) )
774
+ . unwrap_or_default ( ) ;
782
775
extracted_uinodes. uinodes . push ( ExtractedUiNode {
783
776
render_entity : commands. spawn ( TemporaryRenderEntity ) . id ( ) ,
784
777
stack_index : uinode. stack_index ,
@@ -850,7 +843,6 @@ pub fn extract_text_shadows(
850
843
( -0.5 * uinode. size ( ) + shadow. offset / uinode. inverse_scale_factor ( ) ) . extend ( 0. ) ,
851
844
) ;
852
845
853
- let mut current_span = usize:: MAX ;
854
846
for (
855
847
i,
856
848
PositionedGlyph {
@@ -861,10 +853,6 @@ pub fn extract_text_shadows(
861
853
} ,
862
854
) in text_layout_info. glyphs . iter ( ) . enumerate ( )
863
855
{
864
- if * span_index != current_span {
865
- current_span = * span_index;
866
- }
867
-
868
856
let rect = texture_atlases
869
857
. get ( & atlas_info. texture_atlas )
870
858
. unwrap ( )
@@ -876,7 +864,7 @@ pub fn extract_text_shadows(
876
864
} ) ;
877
865
878
866
if text_layout_info. glyphs . get ( i + 1 ) . is_none_or ( |info| {
879
- info. span_index != current_span || info. atlas_info . texture != atlas_info. texture
867
+ info. span_index != * span_index || info. atlas_info . texture != atlas_info. texture
880
868
} ) {
881
869
extracted_uinodes. uinodes . push ( ExtractedUiNode {
882
870
render_entity : commands. spawn ( TemporaryRenderEntity ) . id ( ) ,
0 commit comments