Skip to content

Commit

Permalink
Make fade in overlay not block UI
Browse files Browse the repository at this point in the history
  • Loading branch information
benfrankel committed Jul 21, 2024
1 parent 9dcca8c commit 6008ad0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const FADE_OUT_SECS: f32 = 0.2;

fn fade_out(to_screen: Screen) -> impl EntityCommand<World> {
move |mut entity: EntityWorldMut| {
entity.add(widget::overlay).insert((
entity.add(widget::blocking_overlay).insert((
Name::new("ScreenFadeOut"),
ThemeColor::Body.set::<BackgroundColor>(),
FadeOut::new(FADE_OUT_SECS, to_screen),
Expand Down
13 changes: 13 additions & 0 deletions src/ui/widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,19 @@ pub fn row_center(mut entity: EntityWorldMut) {
}

pub fn overlay(mut entity: EntityWorldMut) {
entity.insert(NodeBundle {
style: Style {
position_type: PositionType::Absolute,
width: Percent(100.0),
height: Percent(100.0),
..default()
},
z_index: ZIndex::Global(1000),
..default()
});
}

pub fn blocking_overlay(mut entity: EntityWorldMut) {
entity.insert(NodeBundle {
style: Style {
position_type: PositionType::Absolute,
Expand Down

0 comments on commit 6008ad0

Please sign in to comment.