feat: Add window drag support from winit

Exposes access to the winit window's window_drag method as an action.
This commit is contained in:
Michael Aaron Murphy 2022-10-06 20:38:21 +02:00
parent 77c838011f
commit 7ea7dbef57
No known key found for this signature in database
GPG key ID: B2732D4240C9212C
3 changed files with 16 additions and 0 deletions

View file

@ -615,6 +615,9 @@ pub fn run_command<A, E>(
}
},
command::Action::Window(action) => match action {
window::Action::Drag => {
let _res = window.drag_window();
}
window::Action::Resize { width, height } => {
window.set_inner_size(winit::dpi::LogicalSize {
width,

View file

@ -4,6 +4,11 @@ use iced_native::window;
pub use window::{Event, Mode};
/// Begins dragging the window while the left mouse button is held.
pub fn drag<Message>() -> Command<Message> {
Command::single(command::Action::Window(window::Action::Drag))
}
/// Resizes the window to the given logical dimensions.
pub fn resize<Message>(width: u32, height: u32) -> Command<Message> {
Command::single(command::Action::Window(window::Action::Resize {