Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions crates/bevy_ui/src/layout/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -591,8 +591,8 @@ mod tests {
let ui_root = world
.spawn(NodeBundle {
style: Style {
width: Val::Percent(100.),
height: Val::Percent(100.),
width: Percent(100.),
height: Percent(100.),
..default()
},
..default()
Expand All @@ -602,8 +602,8 @@ mod tests {
let ui_child = world
.spawn(NodeBundle {
style: Style {
width: Val::Percent(100.),
height: Val::Percent(100.),
width: Percent(100.),
height: Percent(100.),
..default()
},
..default()
Expand Down Expand Up @@ -840,8 +840,8 @@ mod tests {
style: Style {
// test should pass without explicitly requiring position_type to be set to Absolute
// position_type: PositionType::Absolute,
width: Val::Px(size),
height: Val::Px(size),
width: Px(size),
height: Px(size),
..default()
},
..default()
Expand All @@ -852,8 +852,8 @@ mod tests {
world.spawn(NodeBundle {
style: Style {
// position_type: PositionType::Absolute,
width: Val::Px(size),
height: Val::Px(size),
width: Px(size),
height: Px(size),
..default()
},
..default()
Expand All @@ -864,8 +864,8 @@ mod tests {
world.spawn(NodeBundle {
style: Style {
// position_type: PositionType::Absolute,
width: Val::Px(size),
height: Val::Px(size),
width: Px(size),
height: Px(size),
..default()
},
..default()
Expand Down Expand Up @@ -959,8 +959,8 @@ mod tests {
.insert(TargetCamera(target_camera_entity))
.insert(Style {
position_type: PositionType::Absolute,
top: Val::Px(pos.y),
left: Val::Px(pos.x),
top: Px(pos.y),
left: Px(pos.x),
..default()
});
}
Expand Down Expand Up @@ -1007,8 +1007,8 @@ mod tests {
NodeBundle {
style: Style {
position_type: PositionType::Absolute,
top: Val::Px(0.),
left: Val::Px(0.),
top: Px(0.),
left: Px(0.),
..default()
},
..default()
Expand Down Expand Up @@ -1133,7 +1133,7 @@ mod tests {
style: Style {
display: Display::Grid,
grid_template_columns: RepeatedGridTrack::min_content(2),
margin: UiRect::all(Val::Px(4.0)),
margin: UiRect::all(Px(4.0)),
..Default::default()
},
..Default::default()
Expand All @@ -1143,8 +1143,8 @@ mod tests {
commands.spawn(NodeBundle {
style: Style {
display: Display::Grid,
width: Val::Px(160.),
height: Val::Px(160.),
width: Px(160.),
height: Px(160.),
..Default::default()
},
..Default::default()
Expand Down Expand Up @@ -1221,8 +1221,8 @@ mod tests {
let ui_root = world
.spawn(NodeBundle {
style: Style {
width: Val::Percent(100.),
height: Val::Percent(100.),
width: Percent(100.),
height: Percent(100.),
..default()
},
..default()
Expand All @@ -1232,8 +1232,8 @@ mod tests {
let ui_child = world
.spawn(NodeBundle {
style: Style {
width: Val::Percent(100.),
height: Val::Percent(100.),
width: Percent(100.),
height: Percent(100.),
..default()
},
..default()
Expand Down
2 changes: 2 additions & 0 deletions crates/bevy_ui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ use widget::UiImageSize;
///
/// This includes the most common types in this crate, re-exported for your convenience.
pub mod prelude {
#[doc(hidden)]
pub use crate::geometry::Val::{Auto, Percent, Px, VMax, VMin, Vh, Vw};
#[cfg(feature = "bevy_text")]
#[allow(deprecated)]
#[doc(hidden)]
Expand Down
4 changes: 2 additions & 2 deletions examples/2d/2d_shapes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ fn setup(
Text::new("Press space to toggle wireframes"),
Style {
position_type: PositionType::Absolute,
top: Val::Px(12.0),
left: Val::Px(12.0),
top: Px(12.0),
left: Px(12.0),
..default()
},
));
Expand Down
4 changes: 2 additions & 2 deletions examples/2d/bloom_2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ fn setup(
Text::default(),
Style {
position_type: PositionType::Absolute,
bottom: Val::Px(12.0),
left: Val::Px(12.0),
bottom: Px(12.0),
left: Px(12.0),
..default()
},
));
Expand Down
4 changes: 2 additions & 2 deletions examples/2d/bounding_2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ fn setup(mut commands: Commands) {
Text::default(),
Style {
position_type: PositionType::Absolute,
bottom: Val::Px(12.0),
left: Val::Px(12.0),
bottom: Px(12.0),
left: Px(12.0),
..default()
},
));
Expand Down
4 changes: 2 additions & 2 deletions examples/2d/sprite_animation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ fn setup(
Text::new("Left Arrow Key: Animate Left Sprite\nRight Arrow Key: Animate Right Sprite"),
Style {
position_type: PositionType::Absolute,
top: Val::Px(12.0),
left: Val::Px(12.0),
top: Px(12.0),
left: Px(12.0),
..default()
},
));
Expand Down
4 changes: 2 additions & 2 deletions examples/2d/wireframe_2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ fn setup(
Text::default(),
Style {
position_type: PositionType::Absolute,
top: Val::Px(12.0),
left: Val::Px(12.0),
top: Px(12.0),
left: Px(12.0),
..default()
},
));
Expand Down
4 changes: 2 additions & 2 deletions examples/3d/3d_shapes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ fn setup(
Text::new("Press space to toggle wireframes"),
Style {
position_type: PositionType::Absolute,
top: Val::Px(12.0),
left: Val::Px(12.0),
top: Px(12.0),
left: Px(12.0),
..default()
},
));
Expand Down
4 changes: 2 additions & 2 deletions examples/3d/anisotropy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ fn spawn_text(commands: &mut Commands, app_status: &AppStatus) {
app_status.create_help_text(),
Style {
position_type: PositionType::Absolute,
bottom: Val::Px(12.0),
left: Val::Px(12.0),
bottom: Px(12.0),
left: Px(12.0),
..default()
},
));
Expand Down
4 changes: 2 additions & 2 deletions examples/3d/anti_aliasing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ fn setup(
Text::default(),
Style {
position_type: PositionType::Absolute,
top: Val::Px(12.0),
left: Val::Px(12.0),
top: Px(12.0),
left: Px(12.0),
..default()
},
));
Expand Down
4 changes: 2 additions & 2 deletions examples/3d/atmospheric_fog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ fn setup_instructions(mut commands: Commands) {
commands.spawn((Text::new("Press Spacebar to Toggle Atmospheric Fog.\nPress S to Toggle Directional Light Fog Influence."),
Style {
position_type: PositionType::Absolute,
bottom: Val::Px(12.0),
left: Val::Px(12.0),
bottom: Px(12.0),
left: Px(12.0),
..default()
})
);
Expand Down
12 changes: 6 additions & 6 deletions examples/3d/auto_exposure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ fn setup(
..default()
},
style: Style {
width: Val::Percent(100.0),
height: Val::Percent(100.0),
width: Percent(100.0),
height: Percent(100.0),
..default()
},
..default()
Expand All @@ -132,8 +132,8 @@ fn setup(
commands.spawn((Text::new("Left / Right - Rotate Camera\nC - Toggle Compensation Curve\nM - Toggle Metering Mask\nV - Visualize Metering Mask"),
text_style.clone(), Style {
position_type: PositionType::Absolute,
top: Val::Px(12.0),
left: Val::Px(12.0),
top: Px(12.0),
left: Px(12.0),
..default()
})
);
Expand All @@ -143,8 +143,8 @@ fn setup(
text_style,
Style {
position_type: PositionType::Absolute,
top: Val::Px(12.0),
right: Val::Px(12.0),
top: Px(12.0),
right: Px(12.0),
..default()
},
ExampleDisplay,
Expand Down
12 changes: 6 additions & 6 deletions examples/3d/blend_modes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ fn setup(
text_style.clone(),
Style {
position_type: PositionType::Absolute,
top: Val::Px(12.0),
left: Val::Px(12.0),
top: Px(12.0),
left: Px(12.0),
..default()
})
);
Expand All @@ -182,8 +182,8 @@ fn setup(
text_style,
Style {
position_type: PositionType::Absolute,
top: Val::Px(12.0),
right: Val::Px(12.0),
top: Px(12.0),
right: Px(12.0),
..default()
},
ExampleDisplay,
Expand Down Expand Up @@ -317,8 +317,8 @@ fn example_control_system(
.world_to_viewport(camera_global_transform, world_position)
.unwrap();

style.top = Val::Px(viewport_position.y);
style.left = Val::Px(viewport_position.x);
style.top = Px(viewport_position.y);
style.left = Px(viewport_position.x);
}

display.0 = format!(
Expand Down
4 changes: 2 additions & 2 deletions examples/3d/bloom_3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ fn setup_scene(
Text::default(),
Style {
position_type: PositionType::Absolute,
bottom: Val::Px(12.0),
left: Val::Px(12.0),
bottom: Px(12.0),
left: Px(12.0),
..default()
},
));
Expand Down
4 changes: 2 additions & 2 deletions examples/3d/clearcoat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ fn spawn_text(commands: &mut Commands, light_mode: &LightMode) {
light_mode.create_help_text(),
Style {
position_type: PositionType::Absolute,
bottom: Val::Px(12.0),
left: Val::Px(12.0),
bottom: Px(12.0),
left: Px(12.0),
..default()
},
));
Expand Down
22 changes: 11 additions & 11 deletions examples/3d/color_grading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ fn add_buttons(commands: &mut Commands, font: &Handle<Font>, color_grading: &Col
style: Style {
flex_direction: FlexDirection::Column,
position_type: PositionType::Absolute,
row_gap: Val::Px(6.0),
left: Val::Px(12.0),
bottom: Val::Px(12.0),
row_gap: Px(6.0),
left: Px(12.0),
bottom: Px(12.0),
..default()
},
..default()
Expand Down Expand Up @@ -181,7 +181,7 @@ fn add_buttons_for_global_controls(
// Add some placeholder text to fill this column.
parent.spawn(NodeBundle {
style: Style {
width: Val::Px(125.0),
width: Px(125.0),
..default()
},
..default()
Expand Down Expand Up @@ -224,7 +224,7 @@ fn add_buttons_for_section(
.with_children(|parent| {
// Spawn the label ("Highlights", etc.)
add_text(parent, &section.to_string(), font, Color::WHITE).insert(Style {
width: Val::Px(125.0),
width: Px(125.0),
..default()
});

Expand Down Expand Up @@ -257,12 +257,12 @@ fn add_button_for_value(
parent
.spawn(ButtonBundle {
style: Style {
border: UiRect::all(Val::Px(1.0)),
width: Val::Px(200.0),
border: UiRect::all(Px(1.0)),
width: Px(200.0),
justify_content: JustifyContent::Center,
align_items: AlignItems::Center,
padding: UiRect::axes(Val::Px(12.0), Val::Px(6.0)),
margin: UiRect::right(Val::Px(12.0)),
padding: UiRect::axes(Px(12.0), Px(6.0)),
margin: UiRect::right(Px(12.0)),
..default()
},
border_color: BorderColor(Color::WHITE),
Expand Down Expand Up @@ -322,8 +322,8 @@ fn add_help_text(
},
Style {
position_type: PositionType::Absolute,
left: Val::Px(12.0),
top: Val::Px(12.0),
left: Px(12.0),
top: Px(12.0),
..default()
},
HelpText,
Expand Down
4 changes: 2 additions & 2 deletions examples/3d/deferred_rendering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ fn setup(
Text::default(),
Style {
position_type: PositionType::Absolute,
top: Val::Px(12.0),
left: Val::Px(12.0),
top: Px(12.0),
left: Px(12.0),
..default()
},
));
Expand Down
4 changes: 2 additions & 2 deletions examples/3d/depth_of_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>, app_settings: R
create_text(&app_settings),
Style {
position_type: PositionType::Absolute,
bottom: Val::Px(12.0),
left: Val::Px(12.0),
bottom: Px(12.0),
left: Px(12.0),
..default()
},
));
Expand Down
Loading