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:
parent
77c838011f
commit
7ea7dbef57
3 changed files with 16 additions and 0 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue