Skip to content

Commit

Permalink
bring back previous childrne order
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickChodowski committed Jul 22, 2024
1 parent 5b55b47 commit 77bdce5
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,30 +122,42 @@ pub fn create_joystick<I: VirtualJoystickID>(
);
let spawn = spawn.with_children(|parent| {
parent.spawn((
VirtualJoystickUIBackground,
VirtualJoystickUIKnob,
ImageBundle {
image: background_img.into(),
image: UiImage {
color: knob_color.unwrap_or(Color::WHITE.with_alpha(0.0)).into(),
texture: knob_img,
..default()
},
style: Style {
position_type: PositionType::Absolute,
width: Val::Px(background_size.x),
height: Val::Px(background_size.y),
width: Val::Px(knob_size.x),
height: Val::Px(knob_size.y),
..default()
},
background_color: background_color.unwrap_or(Color::WHITE.with_alpha(0.0)).into(),
z_index: ZIndex::Local(1),
..default()
},
));

parent.spawn((
VirtualJoystickUIKnob,
VirtualJoystickUIBackground,
ImageBundle {
image: knob_img.into(),
image: UiImage {
color: knob_color.unwrap_or(Color::WHITE.with_alpha(0.0)).into(),
texture: background_img,
..default()
},
style: Style {
position_type: PositionType::Absolute,
width: Val::Px(knob_size.x),
height: Val::Px(knob_size.y),
width: Val::Px(background_size.x),
height: Val::Px(background_size.y),
..default()
},
background_color: knob_color.unwrap_or(Color::WHITE.with_alpha(0.0)).into(),
background_color: background_color
.unwrap_or(Color::WHITE.with_alpha(0.0))
.into(),
z_index: ZIndex::Local(0),
..default()
},
));
Expand Down

0 comments on commit 77bdce5

Please sign in to comment.