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

Fix touch missing pointers #319

Merged
merged 3 commits into from
Jun 12, 2024
Merged
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
23 changes: 16 additions & 7 deletions crates/bevy_picking_core/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ pub fn pointer_events(
if let PressDirection::Up = press_event.direction {
let Some(location) = pointer_location(press_event.pointer_id) else {
error!(
"Unable to get location for pointer {:?}",
press_event.pointer_id
"Unable to get location for pointer {:?} during event {:?}",
press_event.pointer_id, press_event
);
continue;
};
Expand All @@ -271,8 +271,8 @@ pub fn pointer_events(
if let PressDirection::Down = press_event.direction {
let Some(location) = pointer_location(press_event.pointer_id) else {
error!(
"Unable to get location for pointer {:?}",
press_event.pointer_id
"Unable to get location for pointer {:?} during event {:?}",
press_event.pointer_id, press_event
);
continue;
};
Expand All @@ -298,7 +298,10 @@ pub fn pointer_events(
.any(|e| e.contains_key(&hovered_entity))
{
let Some(location) = pointer_location(pointer_id) else {
error!("Unable to get location for pointer {:?}", pointer_id);
error!(
"Unable to get location for pointer {:?} during pointer over",
pointer_id
);
continue;
};
pointer_over.send(Pointer::new(
Expand All @@ -322,7 +325,10 @@ pub fn pointer_events(
.any(|e| e.contains_key(&hovered_entity))
{
let Some(location) = pointer_location(pointer_id) else {
error!("Unable to get location for pointer {:?}", pointer_id);
error!(
"Unable to get location for pointer {:?} during pointer out",
pointer_id
);
continue;
};
pointer_out.send(Pointer::new(
Expand Down Expand Up @@ -466,7 +472,10 @@ pub fn send_click_and_drag_events(
continue;
};
let Some(location) = pointer_location(press.pointer_id) else {
error!("Unable to get location for pointer {:?}", press.pointer_id);
error!(
"Unable to get location for pointer {:?} during event {:?}",
press.pointer_id, press
);
continue;
};

Expand Down
9 changes: 3 additions & 6 deletions crates/bevy_picking_input/src/touch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ use bevy_hierarchy::DespawnRecursiveExt;
use bevy_input::touch::{TouchInput, TouchPhase};
use bevy_math::Vec2;
use bevy_render::camera::RenderTarget;
use bevy_utils::{
tracing::{debug, info},
HashMap, HashSet,
};
use bevy_utils::{tracing::debug, HashMap, HashSet};
use bevy_window::{PrimaryWindow, WindowRef};

use bevy_picking_core::{
Expand Down Expand Up @@ -46,7 +43,7 @@ pub fn touch_pick_events(
};
match touch.phase {
TouchPhase::Started => {
info!("Spawning pointer {:?}", pointer);
debug!("Spawning pointer {:?}", pointer);
commands.spawn((
PointerCoreBundle::new(pointer).with_location(location.clone()),
#[cfg(feature = "selection")]
Expand All @@ -61,7 +58,7 @@ pub fn touch_pick_events(
// Send a move event only if it isn't the same as the last one
if let Some(last_touch) = location_cache.get(&touch.id) {
if last_touch == touch {
break;
continue;
}
input_moves.send(InputMove::new(
pointer,
Expand Down
Loading