diff --git a/CHANGELOG.md b/CHANGELOG.md index 428241a5..1a0df989 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.17.0 + +- Update for bevy 0.12 + # 0.16.0 ## Highlights diff --git a/Cargo.toml b/Cargo.toml index 4f75cec5..844b756e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_mod_picking" -version = "0.16.0" +version = "0.17.0" authors = ["Aevyrie "] edition = "2021" license = "MIT OR Apache-2.0" @@ -19,36 +19,36 @@ all-features = true members = ["crates/*", "backends/*"] [dependencies] -bevy_app = { version = "0.11", default-features = false } -bevy_core = { version = "0.11", default-features = false } -bevy_ecs = { version = "0.11", default-features = false } -bevy_math = { version = "0.11", default-features = false } -bevy_reflect = { version = "0.11", default-features = false } -bevy_render = { version = "0.11", default-features = false } -bevy_text = { version = "0.11", optional = true, default-features = false, features = [ +bevy_app = { version = "0.12", default-features = false } +bevy_core = { version = "0.12", default-features = false } +bevy_ecs = { version = "0.12", default-features = false } +bevy_math = { version = "0.12", default-features = false } +bevy_reflect = { version = "0.12", default-features = false } +bevy_render = { version = "0.12", default-features = false } +bevy_text = { version = "0.12", optional = true, default-features = false, features = [ "default_font", ] } -bevy_ui = { version = "0.11", optional = true, default-features = false } -bevy_utils = { version = "0.11", default-features = false } -bevy_window = { version = "0.11", default-features = false } +bevy_ui = { version = "0.12", optional = true, default-features = false } +bevy_utils = { version = "0.12", default-features = false } +bevy_window = { version = "0.12", default-features = false } -bevy_eventlistener = "0.5" -bevy_egui = { optional = true, version = "0.21" } -bevy_rapier3d = { optional = true, version = "0.22" } +bevy_eventlistener = "0.6" +bevy_egui = { optional = true, version = "0.23" } +bevy_rapier3d = { optional = true, version = "0.23" } # Local -bevy_picking_core = { path = "crates/bevy_picking_core", version = "0.16" } -bevy_picking_input = { path = "crates/bevy_picking_input", version = "0.16" } -bevy_picking_selection = { optional = true, path = "crates/bevy_picking_selection", version = "0.16" } -bevy_picking_highlight = { optional = true, path = "crates/bevy_picking_highlight", version = "0.16" } -bevy_picking_raycast = { optional = true, path = "backends/bevy_picking_raycast", version = "0.16" } -bevy_picking_ui = { optional = true, path = "backends/bevy_picking_ui", version = "0.16" } -bevy_picking_rapier = { optional = true, path = "backends/bevy_picking_rapier", version = "0.16" } -bevy_picking_sprite = { optional = true, path = "backends/bevy_picking_sprite", version = "0.16" } -bevy_picking_egui = { optional = true, path = "backends/bevy_picking_egui", version = "0.16" } +bevy_picking_core = { path = "crates/bevy_picking_core", version = "0.17" } +bevy_picking_input = { path = "crates/bevy_picking_input", version = "0.17" } +bevy_picking_selection = { optional = true, path = "crates/bevy_picking_selection", version = "0.17" } +bevy_picking_highlight = { optional = true, path = "crates/bevy_picking_highlight", version = "0.17" } +bevy_picking_raycast = { optional = true, path = "backends/bevy_picking_raycast", version = "0.17" } +bevy_picking_ui = { optional = true, path = "backends/bevy_picking_ui", version = "0.17" } +bevy_picking_rapier = { optional = true, path = "backends/bevy_picking_rapier", version = "0.17" } +bevy_picking_sprite = { optional = true, path = "backends/bevy_picking_sprite", version = "0.17" } +bevy_picking_egui = { optional = true, path = "backends/bevy_picking_egui", version = "0.17" } [dev-dependencies] -bevy = { version = "0.11", default-features = false, features = [ +bevy = { version = "0.12", default-features = false, features = [ "bevy_winit", "x11", "bevy_gltf", diff --git a/README.md b/README.md index e6e91ba1..6e486c73 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,7 @@ I intend to track the `main` branch of Bevy. PRs supporting this are welcome! | bevy | bevy_mod_picking | | ---- | ---------------- | +| 0.12 | 0.17 | | 0.11 | 0.15, 0.16 | | 0.10 | 0.12, 0.13, 0.14 | | 0.9 | 0.10, 0.11 | diff --git a/backends/bevy_picking_egui/Cargo.toml b/backends/bevy_picking_egui/Cargo.toml index da233ec3..b536a04a 100644 --- a/backends/bevy_picking_egui/Cargo.toml +++ b/backends/bevy_picking_egui/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_picking_egui" -version = "0.16.0" +version = "0.17.0" edition = "2021" authors = ["Aevyrie "] license = "MIT OR Apache-2.0" @@ -13,15 +13,15 @@ resolver = "2" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -bevy_app = { version = "0.11", default-features = false } -bevy_ecs = { version = "0.11", default-features = false } -bevy_reflect = { version = "0.11", default-features = false } -bevy_render = { version = "0.11", default-features = false } +bevy_app = { version = "0.12", default-features = false } +bevy_ecs = { version = "0.12", default-features = false } +bevy_reflect = { version = "0.12", default-features = false } +bevy_render = { version = "0.12", default-features = false } -bevy_egui = "0.21" +bevy_egui = "0.23" # Local -bevy_picking_core = { path = "../../crates/bevy_picking_core", version = "0.16" } -bevy_picking_selection = { path = "../../crates/bevy_picking_selection", optional = true, version = "0.16" } +bevy_picking_core = { path = "../../crates/bevy_picking_core", version = "0.17" } +bevy_picking_selection = { path = "../../crates/bevy_picking_selection", optional = true, version = "0.17" } [features] selection = ["bevy_picking_selection"] diff --git a/backends/bevy_picking_rapier/Cargo.toml b/backends/bevy_picking_rapier/Cargo.toml index ee46ea33..04e0de9a 100644 --- a/backends/bevy_picking_rapier/Cargo.toml +++ b/backends/bevy_picking_rapier/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_picking_rapier" -version = "0.16.0" +version = "0.17.0" edition = "2021" authors = ["Aevyrie "] license = "MIT OR Apache-2.0" @@ -13,15 +13,15 @@ resolver = "2" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -bevy_app = { version = "0.11", default-features = false } -bevy_ecs = { version = "0.11", default-features = false } -bevy_math = { version = "0.11", default-features = false } -bevy_reflect = { version = "0.11", default-features = false } -bevy_render = { version = "0.11", default-features = false } -bevy_transform = { version = "0.11", default-features = false } -bevy_utils = { version = "0.11", default-features = false } -bevy_window = { version = "0.11", default-features = false } +bevy_app = { version = "0.12", default-features = false } +bevy_ecs = { version = "0.12", default-features = false } +bevy_math = { version = "0.12", default-features = false } +bevy_reflect = { version = "0.12", default-features = false } +bevy_render = { version = "0.12", default-features = false } +bevy_transform = { version = "0.12", default-features = false } +bevy_utils = { version = "0.12", default-features = false } +bevy_window = { version = "0.12", default-features = false } -bevy_rapier3d = "0.22" +bevy_rapier3d = "0.23" # Local -bevy_picking_core = { path = "../../crates/bevy_picking_core", version = "0.16" } +bevy_picking_core = { path = "../../crates/bevy_picking_core", version = "0.17" } diff --git a/backends/bevy_picking_raycast/Cargo.toml b/backends/bevy_picking_raycast/Cargo.toml index 184049f8..a356bd75 100644 --- a/backends/bevy_picking_raycast/Cargo.toml +++ b/backends/bevy_picking_raycast/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_picking_raycast" -version = "0.16.0" +version = "0.17.0" edition = "2021" authors = ["Aevyrie "] license = "MIT OR Apache-2.0" @@ -13,13 +13,13 @@ resolver = "2" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -bevy_app = { version = "0.11", default-features = false } -bevy_ecs = { version = "0.11", default-features = false } -bevy_reflect = { version = "0.11", default-features = false } -bevy_render = { version = "0.11", default-features = false } -bevy_transform = { version = "0.11", default-features = false } -bevy_window = { version = "0.11", default-features = false } +bevy_app = { version = "0.12", default-features = false } +bevy_ecs = { version = "0.12", default-features = false } +bevy_reflect = { version = "0.12", default-features = false } +bevy_render = { version = "0.12", default-features = false } +bevy_transform = { version = "0.12", default-features = false } +bevy_window = { version = "0.12", default-features = false } -bevy_mod_raycast = "0.15" +bevy_mod_raycast = "0.16" # Local -bevy_picking_core = { path = "../../crates/bevy_picking_core", version = "0.16" } +bevy_picking_core = { path = "../../crates/bevy_picking_core", version = "0.17" } diff --git a/backends/bevy_picking_sprite/Cargo.toml b/backends/bevy_picking_sprite/Cargo.toml index d3d247cb..dd982213 100644 --- a/backends/bevy_picking_sprite/Cargo.toml +++ b/backends/bevy_picking_sprite/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_picking_sprite" -version = "0.16.0" +version = "0.17.0" edition = "2021" authors = ["Aevyrie "] license = "MIT OR Apache-2.0" @@ -13,13 +13,13 @@ resolver = "2" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -bevy_app = { version = "0.11", default-features = false } -bevy_asset = { version = "0.11", default-features = false } -bevy_ecs = { version = "0.11", default-features = false } -bevy_math = { version = "0.11", default-features = false } -bevy_render = { version = "0.11", default-features = false } -bevy_sprite = { version = "0.11", default-features = false } -bevy_transform = { version = "0.11", default-features = false } -bevy_window = { version = "0.11", default-features = false } +bevy_app = { version = "0.12", default-features = false } +bevy_asset = { version = "0.12", default-features = false } +bevy_ecs = { version = "0.12", default-features = false } +bevy_math = { version = "0.12", default-features = false } +bevy_render = { version = "0.12", default-features = false } +bevy_sprite = { version = "0.12", default-features = false } +bevy_transform = { version = "0.12", default-features = false } +bevy_window = { version = "0.12", default-features = false } # Local -bevy_picking_core = { path = "../../crates/bevy_picking_core", version = "0.16" } +bevy_picking_core = { path = "../../crates/bevy_picking_core", version = "0.17" } diff --git a/backends/bevy_picking_sprite/src/lib.rs b/backends/bevy_picking_sprite/src/lib.rs index 901d4ced..3edb2085 100644 --- a/backends/bevy_picking_sprite/src/lib.rs +++ b/backends/bevy_picking_sprite/src/lib.rs @@ -46,7 +46,7 @@ pub fn sprite_picking( (Option<&Handle>, Option<&Handle>), &GlobalTransform, Option<&Pickable>, - &ComputedVisibility, + &ViewVisibility, ), Or<(With, With)>, >, @@ -85,7 +85,7 @@ pub fn sprite_picking( let picks: Vec<(Entity, HitData)> = sorted_sprites .iter() .copied() - .filter(|(.., visibility)| visibility.is_visible()) + .filter(|(.., visibility)| visibility.get()) .filter_map(|(entity, sprite, image, sprite_transform, pickable, ..)| { if blocked { return None; @@ -95,7 +95,7 @@ pub fn sprite_picking( let (extents, anchor) = if let Some((sprite, image)) = sprite.0.zip(image.0) { let extents = sprite .custom_size - .or_else(|| images.get(image).map(|f| f.size()))?; + .or_else(|| images.get(image).map(|f| f.size().as_vec2()))?; let anchor = sprite.anchor.as_vec(); (extents, anchor) } else if let Some((sprite, atlas)) = sprite.1.zip(image.1) { diff --git a/backends/bevy_picking_ui/Cargo.toml b/backends/bevy_picking_ui/Cargo.toml index 2e5c4a7f..1c07fcd9 100644 --- a/backends/bevy_picking_ui/Cargo.toml +++ b/backends/bevy_picking_ui/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_picking_ui" -version = "0.16.0" +version = "0.17.0" edition = "2021" authors = ["Aevyrie "] license = "MIT OR Apache-2.0" @@ -13,12 +13,12 @@ resolver = "2" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -bevy_app = { version = "0.11", default-features = false } -bevy_ecs = { version = "0.11", default-features = false } -bevy_math = { version = "0.11", default-features = false } -bevy_render = { version = "0.11", default-features = false } -bevy_transform = { version = "0.11", default-features = false } -bevy_window = { version = "0.11", default-features = false } -bevy_ui = { version = "0.11", default-features = false } +bevy_app = { version = "0.12", default-features = false } +bevy_ecs = { version = "0.12", default-features = false } +bevy_math = { version = "0.12", default-features = false } +bevy_render = { version = "0.12", default-features = false } +bevy_transform = { version = "0.12", default-features = false } +bevy_window = { version = "0.12", default-features = false } +bevy_ui = { version = "0.12", default-features = false } # Local -bevy_picking_core = { path = "../../crates/bevy_picking_core", version = "0.16" } +bevy_picking_core = { path = "../../crates/bevy_picking_core", version = "0.17" } diff --git a/backends/bevy_picking_ui/src/lib.rs b/backends/bevy_picking_ui/src/lib.rs index 08ea263e..36da521d 100644 --- a/backends/bevy_picking_ui/src/lib.rs +++ b/backends/bevy_picking_ui/src/lib.rs @@ -56,7 +56,7 @@ pub struct NodeQuery { relative_cursor_position: Option<&'static mut RelativeCursorPosition>, pickable: Option<&'static Pickable>, calculated_clip: Option<&'static CalculatedClip>, - computed_visibility: Option<&'static ComputedVisibility>, + view_visibility: Option<&'static ViewVisibility>, } /// Computes the UI node entities under each pointer. @@ -114,8 +114,8 @@ pub fn ui_picking( .filter_map(|entity| { if let Ok(node) = node_query.get_mut(*entity) { // Nodes that are not rendered should not be interactable - if let Some(computed_visibility) = node.computed_visibility { - if !computed_visibility.is_visible() { + if let Some(view_visibility) = node.view_visibility { + if !view_visibility.get() { return None; } } diff --git a/crates/bevy_picking_core/Cargo.toml b/crates/bevy_picking_core/Cargo.toml index 2d192f07..7766ba35 100644 --- a/crates/bevy_picking_core/Cargo.toml +++ b/crates/bevy_picking_core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_picking_core" -version = "0.16.0" +version = "0.17.0" edition = "2021" authors = ["Aevyrie "] license = "MIT OR Apache-2.0" @@ -13,13 +13,13 @@ resolver = "2" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -bevy_app = { version = "0.11", default-features = false } -bevy_derive = { version = "0.11", default-features = false } -bevy_ecs = { version = "0.11", default-features = false } -bevy_math = { version = "0.11", default-features = false } -bevy_reflect = { version = "0.11", default-features = false } -bevy_render = { version = "0.11", default-features = false } -bevy_utils = { version = "0.11", default-features = false } -bevy_window = { version = "0.11", default-features = false } +bevy_app = { version = "0.12", default-features = false } +bevy_derive = { version = "0.12", default-features = false } +bevy_ecs = { version = "0.12", default-features = false } +bevy_math = { version = "0.12", default-features = false } +bevy_reflect = { version = "0.12", default-features = false } +bevy_render = { version = "0.12", default-features = false } +bevy_utils = { version = "0.12", default-features = false } +bevy_window = { version = "0.12", default-features = false } -bevy_eventlistener = "0.5" +bevy_eventlistener = "0.6" diff --git a/crates/bevy_picking_core/src/events.rs b/crates/bevy_picking_core/src/events.rs index 999b2894..def8ce55 100644 --- a/crates/bevy_picking_core/src/events.rs +++ b/crates/bevy_picking_core/src/events.rs @@ -220,7 +220,7 @@ pub fn pointer_events( pointer_id, location, delta, - } in input_moves.iter().cloned() + } in input_moves.read().cloned() { for (hovered_entity, hit) in hover_map .get(&pointer_id) @@ -236,7 +236,7 @@ pub fn pointer_events( } } - for press_event in input_presses.iter() { + for press_event in input_presses.read() { let button = press_event.button; // We use the previous hover map because we want to consider pointers that just left the // entity. Without this, touch inputs would never send up events because they are lifted up @@ -377,7 +377,7 @@ pub fn send_click_and_drag_events( pointer_id, location, delta: _, - } in input_move.iter().cloned() + } in input_move.read().cloned() { for button in PointerButton::iter() { let Some(down_list) = down_map.get(&(pointer_id, button)) else { @@ -430,7 +430,7 @@ pub fn send_click_and_drag_events( pointer_location, target, event: Up { button, hit }, - } in pointer_up.iter().cloned() + } in pointer_up.read().cloned() { // Can't have a click without the button being pressed down first if down_map @@ -448,14 +448,14 @@ pub fn send_click_and_drag_events( } // Triggers when button is pressed over an entity - for event in pointer_down.iter() { + for event in pointer_down.read() { let button = event.button; let down_button_entity_map = down_map.entry((event.pointer_id, button)).or_default(); down_button_entity_map.insert(event.target, event.clone()); } // Triggered for all button presses - for press in input_presses.iter() { + for press in input_presses.read() { if press.direction != pointer::PressDirection::Up { continue; // We are only interested in button releases } @@ -507,7 +507,7 @@ pub fn send_drag_over_events( pointer_location, target, event: Over { hit }, - } in pointer_over.iter().cloned() + } in pointer_over.read().cloned() { for button in PointerButton::iter() { for drag_target in drag_map @@ -541,7 +541,7 @@ pub fn send_drag_over_events( pointer_location, target, event: Move { hit, delta: _ }, - } in pointer_move.iter().cloned() + } in pointer_move.read().cloned() { for button in PointerButton::iter() { for drag_target in drag_map @@ -575,7 +575,7 @@ pub fn send_drag_over_events( button, distance: _, }, - } in pointer_drag_end.iter().cloned() + } in pointer_drag_end.read().cloned() { let Some(drag_over_set) = drag_over_map.get_mut(&(pointer_id, button)) else { continue; @@ -610,7 +610,7 @@ pub fn send_drag_over_events( pointer_location, target, event: Out { hit }, - } in pointer_out.iter().cloned() + } in pointer_out.read().cloned() { for button in PointerButton::iter() { let Some(dragged_over) = drag_over_map.get_mut(&(pointer_id, button)) else { diff --git a/crates/bevy_picking_core/src/focus.rs b/crates/bevy_picking_core/src/focus.rs index 329788ca..6d2623df 100644 --- a/crates/bevy_picking_core/src/focus.rs +++ b/crates/bevy_picking_core/src/focus.rs @@ -96,10 +96,10 @@ fn build_over_map( pointer_over_map: &mut Local, pointer_cancel: &mut EventReader, ) { - let cancelled_pointers: Vec = pointer_cancel.iter().map(|p| p.pointer_id).collect(); + let cancelled_pointers: Vec = pointer_cancel.read().map(|p| p.pointer_id).collect(); for entities_under_pointer in backend_events - .iter() + .read() .filter(|e| !cancelled_pointers.contains(&e.pointer)) { let pointer = entities_under_pointer.pointer; diff --git a/crates/bevy_picking_core/src/pointer.rs b/crates/bevy_picking_core/src/pointer.rs index 59685493..797f711f 100644 --- a/crates/bevy_picking_core/src/pointer.rs +++ b/crates/bevy_picking_core/src/pointer.rs @@ -173,7 +173,7 @@ impl InputPress { mut events: EventReader, mut pointers: Query<(&PointerId, &mut PointerPress)>, ) { - for input_press_event in events.iter() { + for input_press_event in events.read() { pointers.for_each_mut(|(pointer_id, mut pointer)| { if *pointer_id == input_press_event.pointer_id { let is_down = input_press_event.direction == PressDirection::Down; @@ -256,7 +256,7 @@ impl InputMove { mut events: EventReader, mut pointers: Query<(&PointerId, &mut PointerLocation)>, ) { - for event_pointer in events.iter() { + for event_pointer in events.read() { pointers.for_each_mut(|(id, mut pointer)| { if *id == event_pointer.pointer_id { pointer.location = Some(event_pointer.location.to_owned()); diff --git a/crates/bevy_picking_highlight/Cargo.toml b/crates/bevy_picking_highlight/Cargo.toml index acf66143..eb4daa86 100644 --- a/crates/bevy_picking_highlight/Cargo.toml +++ b/crates/bevy_picking_highlight/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_picking_highlight" -version = "0.16.0" +version = "0.17.0" edition = "2021" authors = ["Aevyrie "] license = "MIT OR Apache-2.0" @@ -13,16 +13,16 @@ resolver = "2" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -bevy_app = { version = "0.11", default-features = false } -bevy_asset = { version = "0.11", default-features = false } -bevy_ecs = { version = "0.11", default-features = false } -bevy_reflect = { version = "0.11", default-features = false } -bevy_render = { version = "0.11", optional = true, default-features = false } -bevy_pbr = { version = "0.11", optional = true, default-features = false } -bevy_sprite = { version = "0.11", optional = true, default-features = false } +bevy_app = { version = "0.12", default-features = false } +bevy_asset = { version = "0.12", default-features = false } +bevy_ecs = { version = "0.12", default-features = false } +bevy_reflect = { version = "0.12", default-features = false } +bevy_render = { version = "0.12", optional = true, default-features = false } +bevy_pbr = { version = "0.12", optional = true, default-features = false } +bevy_sprite = { version = "0.12", optional = true, default-features = false } -bevy_picking_core = { path = "../bevy_picking_core", version = "0.16" } -bevy_picking_selection = { optional = true, path = "../bevy_picking_selection", version = "0.16" } +bevy_picking_core = { path = "../bevy_picking_core", version = "0.17" } +bevy_picking_selection = { optional = true, path = "../bevy_picking_selection", version = "0.17" } [features] selection = ["bevy_picking_selection"] diff --git a/crates/bevy_picking_input/Cargo.toml b/crates/bevy_picking_input/Cargo.toml index c2297e33..05f9fc16 100644 --- a/crates/bevy_picking_input/Cargo.toml +++ b/crates/bevy_picking_input/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_picking_input" -version = "0.16.0" +version = "0.17.0" edition = "2021" authors = ["Aevyrie "] license = "MIT OR Apache-2.0" @@ -13,18 +13,18 @@ resolver = "2" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -bevy_app = { version = "0.11", default-features = false } -bevy_ecs = { version = "0.11", default-features = false } -bevy_hierarchy = { version = "0.11", default-features = false } -bevy_input = { version = "0.11", default-features = false } -bevy_math = { version = "0.11", default-features = false } -bevy_reflect = { version = "0.11", default-features = false } -bevy_render = { version = "0.11", default-features = false } -bevy_utils = { version = "0.11", default-features = false } -bevy_window = { version = "0.11", default-features = false } +bevy_app = { version = "0.12", default-features = false } +bevy_ecs = { version = "0.12", default-features = false } +bevy_hierarchy = { version = "0.12", default-features = false } +bevy_input = { version = "0.12", default-features = false } +bevy_math = { version = "0.12", default-features = false } +bevy_reflect = { version = "0.12", default-features = false } +bevy_render = { version = "0.12", default-features = false } +bevy_utils = { version = "0.12", default-features = false } +bevy_window = { version = "0.12", default-features = false } -bevy_picking_core = { path = "../bevy_picking_core", version = "0.16" } -bevy_picking_selection = { optional = true, path = "../bevy_picking_selection", version = "0.16" } +bevy_picking_core = { path = "../bevy_picking_core", version = "0.17" } +bevy_picking_selection = { optional = true, path = "../bevy_picking_selection", version = "0.17" } [features] selection = ["bevy_picking_selection"] diff --git a/crates/bevy_picking_input/src/debug.rs b/crates/bevy_picking_input/src/debug.rs index c4af092a..7bd6487a 100644 --- a/crates/bevy_picking_input/src/debug.rs +++ b/crates/bevy_picking_input/src/debug.rs @@ -7,10 +7,10 @@ use bevy_picking_core::pointer::{InputMove, InputPress}; /// Listens for input events and prints them. pub fn print(mut moves: EventReader, mut presses: EventReader) { - for event in moves.iter() { + for event in moves.read() { info!("Input Move: {:?}", event.pointer_id); } - for event in presses.iter() { + for event in presses.read() { info!("Input Press: {:?}, {:?}", event.pointer_id, event.direction); } } diff --git a/crates/bevy_picking_input/src/mouse.rs b/crates/bevy_picking_input/src/mouse.rs index f7b93096..d3b5ad6d 100644 --- a/crates/bevy_picking_input/src/mouse.rs +++ b/crates/bevy_picking_input/src/mouse.rs @@ -31,7 +31,7 @@ pub fn mouse_pick_events( mut pointer_move: EventWriter, mut pointer_presses: EventWriter, ) { - for event in cursor_moves.iter() { + for event in cursor_moves.read() { pointer_move.send(InputMove::new( PointerId::Mouse, Location { @@ -45,7 +45,7 @@ pub fn mouse_pick_events( *cursor_last = event.position; } - for input in mouse_inputs.iter() { + for input in mouse_inputs.read() { let button = match input.button { MouseButton::Left => PointerButton::Primary, MouseButton::Right => PointerButton::Secondary, diff --git a/crates/bevy_picking_input/src/touch.rs b/crates/bevy_picking_input/src/touch.rs index fdf88c5c..6908f66b 100644 --- a/crates/bevy_picking_input/src/touch.rs +++ b/crates/bevy_picking_input/src/touch.rs @@ -33,7 +33,7 @@ pub fn touch_pick_events( mut input_presses: EventWriter, mut cancel_events: EventWriter, ) { - for touch in touches.iter() { + for touch in touches.read() { let pointer = PointerId::Touch(touch.id); let location = Location { target: RenderTarget::Window(WindowRef::Primary) @@ -89,7 +89,7 @@ pub fn deactivate_touch_pointers( pointers: Query<(Entity, &PointerId)>, mut touches: EventReader, ) { - for touch in touches.iter() { + for touch in touches.read() { match touch.phase { TouchPhase::Ended | TouchPhase::Canceled => { for (entity, pointer) in &pointers { diff --git a/crates/bevy_picking_selection/Cargo.toml b/crates/bevy_picking_selection/Cargo.toml index 9bbc562b..acf1215c 100644 --- a/crates/bevy_picking_selection/Cargo.toml +++ b/crates/bevy_picking_selection/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_picking_selection" -version = "0.16.0" +version = "0.17.0" edition = "2021" authors = ["Aevyrie "] license = "MIT OR Apache-2.0" @@ -13,12 +13,12 @@ resolver = "2" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -bevy_app = { version = "0.11", default-features = false } -bevy_ecs = { version = "0.11", default-features = false } -bevy_input = { version = "0.11", default-features = false } -bevy_reflect = { version = "0.11", default-features = false } -bevy_utils = { version = "0.11", default-features = false } +bevy_app = { version = "0.12", default-features = false } +bevy_ecs = { version = "0.12", default-features = false } +bevy_input = { version = "0.12", default-features = false } +bevy_reflect = { version = "0.12", default-features = false } +bevy_utils = { version = "0.12", default-features = false } -bevy_eventlistener = "0.5" +bevy_eventlistener = "0.6" -bevy_picking_core = { path = "../bevy_picking_core", version = "0.16" } +bevy_picking_core = { path = "../bevy_picking_core", version = "0.17" } diff --git a/crates/bevy_picking_selection/src/lib.rs b/crates/bevy_picking_selection/src/lib.rs index a60e8d19..96890df5 100644 --- a/crates/bevy_picking_selection/src/lib.rs +++ b/crates/bevy_picking_selection/src/lib.rs @@ -135,7 +135,7 @@ pub fn send_selection_events( target, event: _, } in pointer_down - .iter() + .read() .filter(|pointer| pointer.event.button == PointerButton::Primary) { pointer_down_list.insert(pointer_id); @@ -164,7 +164,7 @@ pub fn send_selection_events( // so, and the setting is enabled, deselect everything. if settings.click_nothing_deselect_all { for press in presses - .iter() + .read() .filter(|p| p.is_just_down(PointerButton::Primary)) { let id = press.pointer_id; @@ -194,7 +194,7 @@ pub fn send_selection_events( target, event: _, } in pointer_click - .iter() + .read() .filter(|pointer| pointer.event.button == PointerButton::Primary) { let multiselect = pointers @@ -235,12 +235,12 @@ pub fn update_state_from_events( mut selections: EventReader>, mut deselections: EventReader>, ) { - for selection in selections.iter() { + for selection in selections.read() { if let Ok(mut select_me) = selectables.get_mut(selection.target) { select_me.is_selected = true; } } - for deselection in deselections.iter() { + for deselection in deselections.read() { if let Ok(mut deselect_me) = selectables.get_mut(deselection.target) { deselect_me.is_selected = false; } diff --git a/examples/event_listener.rs b/examples/event_listener.rs index 1b387a9f..82575f28 100644 --- a/examples/event_listener.rs +++ b/examples/event_listener.rs @@ -151,7 +151,7 @@ impl From>> for DoSomethingComplex { /// Unlike callback systems, this is a normal system that can be run in parallel with other systems. fn receive_greetings(mut greetings: EventReader) { - for event in greetings.iter() { + for event in greetings.read() { info!( "Hello {:?}, you are {:?} depth units away from the pointer", event.0, event.1 diff --git a/examples/many_buttons.rs b/examples/many_buttons.rs index 635bb0b2..f167e766 100644 --- a/examples/many_buttons.rs +++ b/examples/many_buttons.rs @@ -80,7 +80,11 @@ fn setup(mut commands: Commands) { commands .spawn(NodeBundle { style: Style { + flex_direction: FlexDirection::Column, + justify_content: JustifyContent::Center, + align_items: AlignItems::Center, width: Val::Percent(100.), + height: Val::Percent(100.), ..default() }, ..default() diff --git a/examples/split_screen.rs b/examples/split_screen.rs index 0a792467..24539cbf 100644 --- a/examples/split_screen.rs +++ b/examples/split_screen.rs @@ -92,7 +92,7 @@ fn set_camera_viewports( // We need to dynamically resize the camera's viewports whenever the window size changes so then // each camera always takes up half the screen. A resize_event is sent when the window is first // created, allowing us to reuse this system for initial setup. - for resize_event in resize_events.iter() { + for resize_event in resize_events.read() { let window = windows.get(resize_event.window).unwrap(); let mut left_camera = left_camera.single_mut(); left_camera.viewport = Some(bevy::render::camera::Viewport { diff --git a/src/debug/mod.rs b/src/debug/mod.rs index c212d6c5..bf6dd921 100644 --- a/src/debug/mod.rs +++ b/src/debug/mod.rs @@ -159,14 +159,14 @@ impl Plugin for DebugPickingPlugin { /// Listens for pointer events of type `E` and logs them at "debug" level pub fn log_debug(mut pointer_events: EventReader>) { - for event in pointer_events.iter() { + for event in pointer_events.read() { debug!("{event}"); } } /// Listens for pointer events of type `E` and logs them at "trace" level pub fn log_trace(mut pointer_events: EventReader>) { - for event in pointer_events.iter() { + for event in pointer_events.read() { trace!("{event}"); } }