Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use default resolution for viewport_debug example #9666

Merged
merged 2 commits into from Sep 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
42 changes: 22 additions & 20 deletions examples/ui/viewport_debug.rs
Expand Up @@ -31,8 +31,10 @@ fn main() {
.insert_resource(UiScale(2.0))
.add_plugins(DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window {
resolution: [1600., 1200.].into(),
title: "Viewport Coordinates Debug".to_string(),
// This example relies on these specific viewport dimensions, so let's explicitly
// define them.
resolution: [1280., 720.].into(),
resizable: false,
..Default::default()
}),
Expand Down Expand Up @@ -164,9 +166,9 @@ fn spawn_with_pixel_coords(commands: &mut Commands) {
.spawn((
NodeBundle {
style: Style {
width: Val::Px(800.),
height: Val::Px(600.),
border: UiRect::axes(Val::Px(40.), Val::Px(30.)),
width: Val::Px(640.),
height: Val::Px(360.),
border: UiRect::axes(Val::Px(32.), Val::Px(18.)),
flex_wrap: FlexWrap::Wrap,
..default()
},
Expand All @@ -178,9 +180,9 @@ fn spawn_with_pixel_coords(commands: &mut Commands) {
.with_children(|builder| {
builder.spawn(NodeBundle {
style: Style {
width: Val::Px(240.),
height: Val::Px(180.),
border: UiRect::axes(Val::Px(30.), Val::Px(30.)),
width: Val::Px(192.),
height: Val::Px(108.),
border: UiRect::axes(Val::Px(18.), Val::Px(18.)),
..default()
},
background_color: PALETTE[2].into(),
Expand All @@ -190,8 +192,8 @@ fn spawn_with_pixel_coords(commands: &mut Commands) {

builder.spawn(NodeBundle {
style: Style {
width: Val::Px(480.),
height: Val::Px(180.),
width: Val::Px(384.),
height: Val::Px(108.),
..default()
},
background_color: PALETTE[3].into(),
Expand All @@ -200,9 +202,9 @@ fn spawn_with_pixel_coords(commands: &mut Commands) {

builder.spawn(NodeBundle {
style: Style {
width: Val::Px(360.),
height: Val::Px(180.),
border: UiRect::left(Val::Px(180.)),
width: Val::Px(288.),
height: Val::Px(108.),
border: UiRect::left(Val::Px(144.)),
..default()
},
background_color: PALETTE[4].into(),
Expand All @@ -212,9 +214,9 @@ fn spawn_with_pixel_coords(commands: &mut Commands) {

builder.spawn(NodeBundle {
style: Style {
width: Val::Px(360.),
height: Val::Px(180.),
border: UiRect::right(Val::Px(180.)),
width: Val::Px(288.),
height: Val::Px(108.),
border: UiRect::right(Val::Px(144.)),
..default()
},
background_color: PALETTE[5].into(),
Expand All @@ -224,8 +226,8 @@ fn spawn_with_pixel_coords(commands: &mut Commands) {

builder.spawn(NodeBundle {
style: Style {
width: Val::Px(480.),
height: Val::Px(180.),
width: Val::Px(384.),
height: Val::Px(108.),
..default()
},
background_color: PALETTE[6].into(),
Expand All @@ -234,9 +236,9 @@ fn spawn_with_pixel_coords(commands: &mut Commands) {

builder.spawn(NodeBundle {
style: Style {
width: Val::Px(240.),
height: Val::Px(180.),
border: UiRect::axes(Val::Px(30.), Val::Px(30.)),
width: Val::Px(192.),
height: Val::Px(108.),
border: UiRect::axes(Val::Px(18.), Val::Px(18.)),
..default()
},
background_color: PALETTE[7].into(),
Expand Down