From 67408311f45d341509538f8cc185978da66b6ace Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 30 Nov 2023 23:40:33 +0100 Subject: Use actual floats for logical coordinates --- runtime/src/window.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'runtime/src/window.rs') diff --git a/runtime/src/window.rs b/runtime/src/window.rs index 375ce889..f46ac1b8 100644 --- a/runtime/src/window.rs +++ b/runtime/src/window.rs @@ -10,7 +10,7 @@ pub use screenshot::Screenshot; use crate::command::{self, Command}; use crate::core::time::Instant; use crate::core::window::{self, Event, Icon, Level, Mode, UserAttention}; -use crate::core::Size; +use crate::core::{Point, Size}; use crate::futures::event; use crate::futures::Subscription; @@ -48,17 +48,14 @@ pub fn drag(id: window::Id) -> Command { } /// Resizes the window to the given logical dimensions. -pub fn resize( - id: window::Id, - new_size: Size, -) -> Command { +pub fn resize(id: window::Id, new_size: Size) -> Command { Command::single(command::Action::Window(id, Action::Resize(new_size))) } /// Fetches the window's size in logical dimensions. pub fn fetch_size( id: window::Id, - f: impl FnOnce(Size) -> Message + 'static, + f: impl FnOnce(Size) -> Message + 'static, ) -> Command { Command::single(command::Action::Window(id, Action::FetchSize(Box::new(f)))) } @@ -74,8 +71,8 @@ pub fn minimize(id: window::Id, minimized: bool) -> Command { } /// Moves the window to the given logical coordinates. -pub fn move_to(id: window::Id, x: i32, y: i32) -> Command { - Command::single(command::Action::Window(id, Action::Move { x, y })) +pub fn move_to(id: window::Id, position: Point) -> Command { + Command::single(command::Action::Window(id, Action::Move(position))) } /// Changes the [`Mode`] of the window. -- cgit