mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 12:43:34 +00:00
Change Window::physical_cursor_position
to use the physical size of the window (#9657)
# Objective `Window::physical_cursor_position` checks to see if the cursor's position is inside the window but it constructs the bounding rect for the window using its logical size and then checks to see if it contains the cursor's physical position. When the physical size is smaller than the logical size, this leaves a dead zone where the cursor is over the window but its position is unreported. fixes: #9656 ## Solution Use the physical size of the window.
This commit is contained in:
parent
ee3cc8ca86
commit
11567b31f9
1 changed files with 8 additions and 1 deletions
|
@ -330,7 +330,14 @@ impl Window {
|
|||
match self.internal.physical_cursor_position {
|
||||
Some(position) => {
|
||||
let position = position.as_vec2();
|
||||
if Rect::new(0., 0., self.width(), self.height()).contains(position) {
|
||||
if Rect::new(
|
||||
0.,
|
||||
0.,
|
||||
self.physical_width() as f32,
|
||||
self.physical_height() as f32,
|
||||
)
|
||||
.contains(position)
|
||||
{
|
||||
Some(position)
|
||||
} else {
|
||||
None
|
||||
|
|
Loading…
Reference in a new issue