wgpu windows (fixed) (#3257)
* Working triangle rendering with wgpu in examples. Resize needs work in order to not reinitialize everything but only the bits needed. Naming of variables and resources are wonky and not the greatest. * The child window wasn't being resized along with the parent. This works. the abstractions in place should be passed the bounds rect down into the desktopservice to resize as opposed to in the app impl instead of how they are rn. --------- Co-authored-by: Vineeth Yeevani <vineethyeevani@Vineeths-MacBook-Air.local> Co-authored-by: Vineeth Yeevani <vineeth.yeevani@gmail.com>
This commit is contained in:
8 files changed
+983
-289
No files matched your search
@@ -17,6 +17,7 @@ use std::{
|
||||
sync::Arc,
|
||||
};
|
||||
use tao::{
|
||||
dpi::PhysicalSize,
|
||||
event::Event,
|
||||
event_loop::{ControlFlow, EventLoop, EventLoopBuilder, EventLoopProxy, EventLoopWindowTarget},
|
||||
window::WindowId,
|
||||
@@ -222,6 +223,27 @@ impl App {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn resize_window(&self, size: PhysicalSize<u32>) {
|
||||
// TODO: the app layer should avoid directly manipulating the webview webview instance internals.
|
||||
// Window creation and modification is the responsibility of the webview instance so it makes sense to
|
||||
// encapsulate that there.
|
||||
self.webviews.values().for_each(|webview_instance| {
|
||||
use wry::Rect;
|
||||
|
||||
webview_instance
|
||||
.desktop_context
|
||||
.webview
|
||||
.set_bounds(Rect {
|
||||
position: wry::dpi::Position::Logical(wry::dpi::LogicalPosition::new(0.0, 0.0)),
|
||||
size: wry::dpi::Size::Physical(wry::dpi::PhysicalSize::new(
|
||||
size.width,
|
||||
size.height,
|
||||
)),
|
||||
})
|
||||
.unwrap();
|
||||
});
|
||||
}
|
||||
|
||||
pub fn handle_start_cause_init(&mut self) {
|
||||
let virtual_dom = self.unmounted_dom.take().unwrap();
|
||||
let mut cfg = self.cfg.take().unwrap();
|
||||
|
||||
Reference in new issue
Block a user