Skip to content

Commit

Permalink
rename window_position to position
Browse files Browse the repository at this point in the history
  • Loading branch information
tguichaoua committed Feb 20, 2024
1 parent a372e40 commit ebba70c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion examples/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fn setup(mut commands: Commands) {
}

fn print_cursor_location(cursor: Res<CursorLocation>) {
if let Some(position) = cursor.window_position() {
if let Some(position) = cursor.position() {
info!("Cursor position: {position:?}");
} else {
info!("The cursor is not in any window");
Expand Down
2 changes: 1 addition & 1 deletion examples/multiple_windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ fn print_cursor_location(
cursor.camera,
name_q.get(cursor.camera).unwrap().0
),
cursor.window_position.to_string(),
cursor.position.to_string(),
cursor.world_position.to_string(),
);
} else {
Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ pub struct Location {
/// See [`Window::cursor_position`].
///
/// [`Window::cursor_position`]: https://docs.rs/bevy/0.13.0/bevy/window/struct.Window.html#method.cursor_position
pub window_position: Vec2,
pub position: Vec2,

/// The entity id of the window that contains the cursor.
pub window: Entity,
Expand Down Expand Up @@ -153,8 +153,8 @@ impl CursorLocation {
///
/// [`Window::cursor_position`]: https://docs.rs/bevy/0.13.0/bevy/window/struct.Window.html#method.cursor_position
#[inline]
pub fn window_position(&self) -> Option<Vec2> {
self.get().map(|data| data.window_position)
pub fn position(&self) -> Option<Vec2> {
self.get().map(|data| data.position)
}

/// The entity id of the window that contains the cursor.
Expand Down Expand Up @@ -265,7 +265,7 @@ fn update_cursor_location_res(
};

cursor.set_if_neq(Some(Location {
window_position: cursor_position,
position: cursor_position,
window: win_ref,
camera: camera_ref,

Expand Down

0 comments on commit ebba70c

Please sign in to comment.