mirror of
https://github.com/danbulant/appit
synced 2026-05-26 21:32:02 +00:00
Renaming location to position
This commit is contained in:
parent
da03d41656
commit
aecd00917c
2 changed files with 22 additions and 22 deletions
|
|
@ -274,8 +274,8 @@ impl<Message> Windows<Message> {
|
||||||
if let Some(max_inner_size) = attrs.max_inner_size {
|
if let Some(max_inner_size) = attrs.max_inner_size {
|
||||||
builder = builder.with_max_inner_size(max_inner_size);
|
builder = builder.with_max_inner_size(max_inner_size);
|
||||||
}
|
}
|
||||||
if let Some(location) = attrs.location {
|
if let Some(position) = attrs.position {
|
||||||
builder = builder.with_position(location);
|
builder = builder.with_position(position);
|
||||||
}
|
}
|
||||||
if let Some(resize_increments) = attrs.resize_increments {
|
if let Some(resize_increments) = attrs.resize_increments {
|
||||||
builder = builder.with_resize_increments(resize_increments);
|
builder = builder.with_resize_increments(resize_increments);
|
||||||
|
|
|
||||||
|
|
@ -102,8 +102,8 @@ pub struct WindowAttributes<ParentWindowEvent> {
|
||||||
pub min_inner_size: Option<Size>,
|
pub min_inner_size: Option<Size>,
|
||||||
/// The maximum inner size of the window.
|
/// The maximum inner size of the window.
|
||||||
pub max_inner_size: Option<Size>,
|
pub max_inner_size: Option<Size>,
|
||||||
/// The location of the top-left of the frame of the window.
|
/// The position of the top-left of the frame of the window.
|
||||||
pub location: Option<Position>,
|
pub position: Option<Position>,
|
||||||
/// If true, the window can be resized by the user.
|
/// If true, the window can be resized by the user.
|
||||||
pub resizable: bool,
|
pub resizable: bool,
|
||||||
/// The collection of window buttons that are enabled.
|
/// The collection of window buttons that are enabled.
|
||||||
|
|
@ -145,7 +145,7 @@ impl<User> Default for WindowAttributes<User> {
|
||||||
inner_size: defaults.inner_size,
|
inner_size: defaults.inner_size,
|
||||||
min_inner_size: defaults.min_inner_size,
|
min_inner_size: defaults.min_inner_size,
|
||||||
max_inner_size: defaults.max_inner_size,
|
max_inner_size: defaults.max_inner_size,
|
||||||
location: defaults.position,
|
position: defaults.position,
|
||||||
resizable: defaults.resizable,
|
resizable: defaults.resizable,
|
||||||
enabled_buttons: defaults.enabled_buttons,
|
enabled_buttons: defaults.enabled_buttons,
|
||||||
title: defaults.title,
|
title: defaults.title,
|
||||||
|
|
@ -209,14 +209,14 @@ where
|
||||||
occluded: winit.is_visible().unwrap_or(false),
|
occluded: winit.is_visible().unwrap_or(false),
|
||||||
focused: winit.has_focus(),
|
focused: winit.has_focus(),
|
||||||
inner_size: winit.inner_size(),
|
inner_size: winit.inner_size(),
|
||||||
location: winit.inner_position().unwrap_or_default(),
|
position: winit.inner_position().unwrap_or_default(),
|
||||||
scale: winit.scale_factor(),
|
scale: winit.scale_factor(),
|
||||||
theme: winit.theme().unwrap_or(Theme::Dark),
|
theme: winit.theme().unwrap_or(Theme::Dark),
|
||||||
window: winit,
|
window: winit,
|
||||||
next_redraw_target: None,
|
next_redraw_target: None,
|
||||||
close: false,
|
close: false,
|
||||||
modifiers: ModifiersState::default(),
|
modifiers: ModifiersState::default(),
|
||||||
cursor_location: None,
|
cursor_position: None,
|
||||||
mouse_buttons: HashSet::default(),
|
mouse_buttons: HashSet::default(),
|
||||||
keys: HashSet::default(),
|
keys: HashSet::default(),
|
||||||
};
|
};
|
||||||
|
|
@ -240,8 +240,8 @@ where
|
||||||
responses: SyncChannel<AppMessage::Response>,
|
responses: SyncChannel<AppMessage::Response>,
|
||||||
app: App<AppMessage>,
|
app: App<AppMessage>,
|
||||||
inner_size: PhysicalSize<u32>,
|
inner_size: PhysicalSize<u32>,
|
||||||
location: PhysicalPosition<i32>,
|
position: PhysicalPosition<i32>,
|
||||||
cursor_location: Option<PhysicalPosition<f64>>,
|
cursor_position: Option<PhysicalPosition<f64>>,
|
||||||
mouse_buttons: HashSet<MouseButton>,
|
mouse_buttons: HashSet<MouseButton>,
|
||||||
keys: HashSet<VirtualKeyCode>,
|
keys: HashSet<VirtualKeyCode>,
|
||||||
scale: f64,
|
scale: f64,
|
||||||
|
|
@ -331,22 +331,22 @@ where
|
||||||
self.window.set_inner_size(new_size);
|
self.window.set_inner_size(new_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the current location of the window, in pixels.
|
/// Returns the current locpositionation of the window, in pixels.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub const fn location(&self) -> PhysicalPosition<i32> {
|
pub const fn position(&self) -> PhysicalPosition<i32> {
|
||||||
self.location
|
self.position
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the current location of the window, in pixels.
|
/// Sets the current position of the window, in pixels.
|
||||||
pub fn set_location(&self, new_location: PhysicalPosition<i32>) {
|
pub fn set_position(&self, new_position: PhysicalPosition<i32>) {
|
||||||
self.window.set_outer_position(new_location);
|
self.window.set_outer_position(new_position);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the location of the cursor relative to the window's upper-left
|
/// Returns the position of the cursor relative to the window's upper-left
|
||||||
/// corner, in pixels.
|
/// corner, in pixels.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub const fn cursor_location(&self) -> Option<PhysicalPosition<f64>> {
|
pub const fn cursor_position(&self) -> Option<PhysicalPosition<f64>> {
|
||||||
self.cursor_location
|
self.cursor_position
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the current scale factor for the window.
|
/// Returns the current scale factor for the window.
|
||||||
|
|
@ -491,8 +491,8 @@ where
|
||||||
behavior.resized(self);
|
behavior.resized(self);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WindowEvent::Moved(location) => {
|
WindowEvent::Moved(position) => {
|
||||||
self.location = location;
|
self.position = position;
|
||||||
}
|
}
|
||||||
WindowEvent::Destroyed => {
|
WindowEvent::Destroyed => {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -541,14 +541,14 @@ where
|
||||||
device_id,
|
device_id,
|
||||||
position,
|
position,
|
||||||
} => {
|
} => {
|
||||||
self.cursor_location = Some(position);
|
self.cursor_position = Some(position);
|
||||||
behavior.cursor_moved(self, device_id, position);
|
behavior.cursor_moved(self, device_id, position);
|
||||||
}
|
}
|
||||||
WindowEvent::CursorEntered { device_id } => {
|
WindowEvent::CursorEntered { device_id } => {
|
||||||
behavior.cursor_entered(self, device_id);
|
behavior.cursor_entered(self, device_id);
|
||||||
}
|
}
|
||||||
WindowEvent::CursorLeft { device_id } => {
|
WindowEvent::CursorLeft { device_id } => {
|
||||||
self.cursor_location = None;
|
self.cursor_position = None;
|
||||||
behavior.cursor_left(self, device_id);
|
behavior.cursor_left(self, device_id);
|
||||||
}
|
}
|
||||||
WindowEvent::MouseWheel {
|
WindowEvent::MouseWheel {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue