mirror of
https://github.com/rust-windowing/winit.git
synced 2026-06-28 07:33:14 -04:00
Implement web_sys::Canvas event listeners
This commit is contained in:
@@ -24,9 +24,9 @@ impl Window {
|
||||
attr: WindowAttributes,
|
||||
_: PlatformSpecificBuilderAttributes,
|
||||
) -> Result<Self, RootOE> {
|
||||
let canvas = backend::Canvas::create()?;
|
||||
let mut canvas = backend::Canvas::create()?;
|
||||
|
||||
target.register(&canvas);
|
||||
target.register(&mut canvas);
|
||||
|
||||
let runner = target.runner.clone();
|
||||
let redraw = Box::new(move || {
|
||||
@@ -58,6 +58,10 @@ impl Window {
|
||||
Ok(window)
|
||||
}
|
||||
|
||||
pub fn canvas(&self) -> &backend::Canvas {
|
||||
&self.canvas
|
||||
}
|
||||
|
||||
pub fn set_title(&self, title: &str) {
|
||||
backend::Document::set_title(title);
|
||||
}
|
||||
@@ -256,13 +260,6 @@ impl Window {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "stdweb")]
|
||||
impl WindowExtStdweb for RootWindow {
|
||||
fn canvas(&self) -> CanvasElement {
|
||||
self.window.canvas.clone()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub struct Id;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user