Merge pull request #674 from sdwoodbury/feat/resize-window
This commit is contained in:
1 file changed
+8
@@ -7,6 +7,7 @@ use serde_json::Value;
|
|||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use std::future::IntoFuture;
|
use std::future::IntoFuture;
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
|
use wry::application::dpi::LogicalSize;
|
||||||
use wry::application::event_loop::ControlFlow;
|
use wry::application::event_loop::ControlFlow;
|
||||||
use wry::application::event_loop::EventLoopProxy;
|
use wry::application::event_loop::EventLoopProxy;
|
||||||
#[cfg(target_os = "ios")]
|
#[cfg(target_os = "ios")]
|
||||||
@@ -136,6 +137,11 @@ impl DesktopContext {
|
|||||||
let _ = self.proxy.send_event(SetZoomLevel(scale_factor));
|
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
|
/// launch print modal
|
||||||
pub fn print(&self) {
|
pub fn print(&self) {
|
||||||
let _ = self.proxy.send_event(Print);
|
let _ = self.proxy.send_event(Print);
|
||||||
@@ -193,6 +199,7 @@ pub enum UserWindowEvent {
|
|||||||
SetDecorations(bool),
|
SetDecorations(bool),
|
||||||
|
|
||||||
SetZoomLevel(f64),
|
SetZoomLevel(f64),
|
||||||
|
SetInnerSize(LogicalSize<f64>),
|
||||||
|
|
||||||
Print,
|
Print,
|
||||||
DevTool,
|
DevTool,
|
||||||
@@ -265,6 +272,7 @@ impl DesktopController {
|
|||||||
SetDecorations(state) => window.set_decorations(state),
|
SetDecorations(state) => window.set_decorations(state),
|
||||||
|
|
||||||
SetZoomLevel(scale_factor) => webview.zoom(scale_factor),
|
SetZoomLevel(scale_factor) => webview.zoom(scale_factor),
|
||||||
|
SetInnerSize(logical_size) => window.set_inner_size(logical_size),
|
||||||
|
|
||||||
Print => {
|
Print => {
|
||||||
if let Err(e) = webview.print() {
|
if let Err(e) = webview.print() {
|
||||||
|
|||||||
Reference in new issue
Block a user