mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-24 06:11:30 +11:00
Add access to the canvas in the Window
This commit is contained in:
parent
70c7382a09
commit
37dadab745
|
@ -20,4 +20,6 @@ pub mod macos;
|
||||||
pub mod unix;
|
pub mod unix;
|
||||||
pub mod windows;
|
pub mod windows;
|
||||||
|
|
||||||
|
pub mod stdweb;
|
||||||
|
|
||||||
pub mod desktop;
|
pub mod desktop;
|
||||||
|
|
8
src/platform/stdweb.rs
Normal file
8
src/platform/stdweb.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#![cfg(feature = "stdweb")]
|
||||||
|
|
||||||
|
use stdweb::web::html_element::CanvasElement;
|
||||||
|
|
||||||
|
pub trait WindowExtStdweb {
|
||||||
|
fn canvas(&self) -> CanvasElement;
|
||||||
|
}
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
use dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize};
|
use dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize};
|
||||||
use event::{Event, WindowEvent};
|
use event::{Event, WindowEvent};
|
||||||
use icon::Icon;
|
use icon::Icon;
|
||||||
|
use platform::stdweb::WindowExtStdweb;
|
||||||
use monitor::{MonitorHandle as RootMH};
|
use monitor::{MonitorHandle as RootMH};
|
||||||
use window::{CreationError, MouseCursor, WindowAttributes, WindowId as RootWI};
|
use window::{CreationError, MouseCursor, Window as RootWindow, WindowAttributes, WindowId as RootWI};
|
||||||
use super::{EventLoopWindowTarget, register};
|
use super::{EventLoopWindowTarget, register};
|
||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
use std::collections::vec_deque::IntoIter as VecDequeIter;
|
use std::collections::vec_deque::IntoIter as VecDequeIter;
|
||||||
|
@ -317,3 +318,9 @@ impl Window {
|
||||||
unsafe { WindowId::dummy() }
|
unsafe { WindowId::dummy() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WindowExtStdweb for RootWindow {
|
||||||
|
fn canvas(&self) -> CanvasElement {
|
||||||
|
self.window.canvas.clone()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue