Commit a896184
Pass position to
# Objective
- Mouse position from `On<Pointer<Move>>` is `None` when accessing from
an observer added to a window.
- Fixes #21778
## Solution
- Pass position to `HitData` in
`bevy_picking::window::update_window_hits`
- Update doc comment
## Testing
The following now works:
```rust
use bevy::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_systems(Startup, setup)
.run();
}
fn setup(mut commands: Commands) {
commands.spawn(Camera2d);
commands
.spawn(Window::default())
.observe(|trigger: On<Pointer<Move>>| {
assert!(
trigger.hit.position.is_some(),
"Position should not be None"
);
});
}
```HitData for window pointer hits (#21802)1 parent ea15446 commit a896184
1 file changed
+3
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
41 | | - | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
0 commit comments