Merge pull request #674 from sdwoodbury/feat/resize-window

This commit is contained in:
Jon Kelley authored and GitHub committed 2022-12-23 14:08:59 -05:00
commit 4554c06d64
1 file changed
+8
+8
View File
@@ -7,6 +7,7 @@ use serde_json::Value;
use std::future::Future;
use std::future::IntoFuture;
use std::pin::Pin;
use wry::application::dpi::LogicalSize;
use wry::application::event_loop::ControlFlow;
use wry::application::event_loop::EventLoopProxy;
#[cfg(target_os = "ios")]
@@ -136,6 +137,11 @@ impl DesktopContext {
let _ = self.proxy.send_event(SetZoomLevel(scale_factor));
}
/// modifies the inner size of the window
pub fn set_inner_size(&self, logical_size: LogicalSize<f64>) {
let _ = self.proxy.send_event(SetInnerSize(logical_size));
}
/// launch print modal
pub fn print(&self) {
let _ = self.proxy.send_event(Print);
@@ -193,6 +199,7 @@ pub enum UserWindowEvent {
SetDecorations(bool),
SetZoomLevel(f64),
SetInnerSize(LogicalSize<f64>),
Print,
DevTool,
@@ -265,6 +272,7 @@ impl DesktopController {
SetDecorations(state) => window.set_decorations(state),
SetZoomLevel(scale_factor) => webview.zoom(scale_factor),
SetInnerSize(logical_size) => window.set_inner_size(logical_size),
Print => {
if let Err(e) = webview.print() {