feat(DesktopContext): expose set_inner_size
This commit is contained in:
1 parent
3b7b503333
commit
f99991b23b
1 file changed
+8
@@ -1,5 +1,6 @@
|
|||||||
use crate::controller::DesktopController;
|
use crate::controller::DesktopController;
|
||||||
use dioxus_core::ScopeState;
|
use dioxus_core::ScopeState;
|
||||||
|
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;
|
||||||
use wry::application::window::Fullscreen as WryFullscreen;
|
use wry::application::window::Fullscreen as WryFullscreen;
|
||||||
@@ -120,6 +121,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);
|
||||||
@@ -159,6 +165,7 @@ pub enum UserWindowEvent {
|
|||||||
SetDecorations(bool),
|
SetDecorations(bool),
|
||||||
|
|
||||||
SetZoomLevel(f64),
|
SetZoomLevel(f64),
|
||||||
|
SetInnerSize(LogicalSize<f64>),
|
||||||
|
|
||||||
Print,
|
Print,
|
||||||
DevTool,
|
DevTool,
|
||||||
@@ -205,6 +212,7 @@ pub(super) fn handler(
|
|||||||
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