diff --git a/bin/ui-wtf.rs b/bin/ui-wtf.rs index a906988..aa8e16b 100644 --- a/bin/ui-wtf.rs +++ b/bin/ui-wtf.rs @@ -10,10 +10,8 @@ fn main() { }), ..default() })) - // Only run when window is active to reduce cpu cycles - // .insert_resource(WinitSettings::desktop_app()) - .add_startup_system(init) - .add_system(scroll) + .add_systems(Startup, (init,)) + .add_systems(Update, (scroll,)) .run(); } @@ -30,8 +28,9 @@ fn init(mut commands: Commands) { background_color: BackgroundColor(Color::WHITE), style: Style { justify_content: JustifyContent::Center, - size: Size::all(Val::Percent(90.0)), - overflow: Overflow::Hidden, + width: Val::Percent(90.0), + height: Val::Percent(90.0), + overflow: Overflow::clip(), ..default() }, ..default() @@ -45,8 +44,10 @@ fn init(mut commands: Commands) { flex_wrap: FlexWrap::Wrap, flex_direction: FlexDirection::Row, justify_content: JustifyContent::SpaceAround, - size: Size::AUTO, - max_size: Size::UNDEFINED, + width: Val::Auto, + height: Val::Auto, + max_width: Val::Auto, + max_height: Val::Auto, ..default() }, ..default() @@ -73,7 +74,8 @@ fn init(mut commands: Commands) { parent.spawn(NodeBundle { background_color: BackgroundColor(colors[i]), style: Style { - size: Size::all(Val::Px(256.0)), + width: Val::Px(256.0), + height: Val::Px(256.0), padding: UiRect::all(Val::Px(5.0)), ..default() }, @@ -90,7 +92,7 @@ fn scroll( ) { for ev in scroll_evr.iter() { for mut s in query.iter_mut() { - s.position.top = match s.position.top { + s.top = match s.top { Val::Px(current) => Val::Px(current + (ev.y * 5.0)), _ => Val::Px(0.0), };