Skip to content

Commit

Permalink
do not draw text with is_visible = false
Browse files Browse the repository at this point in the history
  • Loading branch information
marius851000 committed Nov 19, 2020
1 parent 4fecb89 commit 5912e59
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions crates/bevy_ui/src/widget/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,20 +153,22 @@ pub fn draw_text_system(
let vertex_buffer_descriptor = font_quad.get_vertex_buffer_descriptor();

for (entity, mut draw, text, node, global_transform) in query.iter_mut() {
if let Some(text_glyphs) = text_pipeline.get_glyphs(&entity) {
let position = global_transform.translation - (node.size / 2.0).extend(0.0);
if draw.is_visible {
if let Some(text_glyphs) = text_pipeline.get_glyphs(&entity) {
let position = global_transform.translation - (node.size / 2.0).extend(0.0);

let mut drawable_text = DrawableText {
render_resource_bindings: &mut render_resource_bindings,
asset_render_resource_bindings: &mut asset_render_resource_bindings,
position,
msaa: &msaa,
text_glyphs: &text_glyphs.glyphs,
font_quad_vertex_descriptor: &vertex_buffer_descriptor,
style: &text.style,
};
let mut drawable_text = DrawableText {
render_resource_bindings: &mut render_resource_bindings,
asset_render_resource_bindings: &mut asset_render_resource_bindings,
position,
msaa: &msaa,
text_glyphs: &text_glyphs.glyphs,
font_quad_vertex_descriptor: &vertex_buffer_descriptor,
style: &text.style,
};

drawable_text.draw(&mut draw, &mut context).unwrap();
drawable_text.draw(&mut draw, &mut context).unwrap();
}
}
}
}

0 comments on commit 5912e59

Please sign in to comment.