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

Improve window cursor usability #7968

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 2 additions & 2 deletions crates/bevy_window/src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ pub struct Cursor {
pub hit_test: bool,

/// The position of this window's cursor.
physical_position: Option<DVec2>,
pub physical_position: Option<DVec2>,
}

impl Default for Cursor {
Expand All @@ -408,7 +408,7 @@ impl Default for Cursor {
icon: CursorIcon::Default,
visible: true,
grab_mode: CursorGrabMode::None,
hit_test: true,
hit_test: false,
physical_position: None,
}
}
Expand Down
6 changes: 5 additions & 1 deletion examples/ui/window_fallthrough.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@
//! If you build this, and hit 'P' it should toggle on/off the mouse's passthrough.
//! Note: this example will not work on following platforms: iOS / Android / Web / X11. Window fall through is not supported there.

use bevy::prelude::*;
use bevy::{prelude::*, window::Cursor};

fn main() {
App::new()
.insert_resource(ClearColor(Color::NONE)) // Use a transparent window, to make effects obvious.
.add_plugins(DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window {
// Set the window's parameters, note we're setting the window to always be on top.
cursor: Cursor {
hit_test: true,
..default()
},
transparent: true,
decorations: true,
window_level: bevy::window::WindowLevel::AlwaysOnTop,
Expand Down