Trait winit::platform::web::WindowExtWebSys

source ·
pub trait WindowExtWebSys {
    // Required methods
    fn canvas(&self) -> Option<HtmlCanvasElement>;
    fn prevent_default(&self) -> bool;
    fn set_prevent_default(&self, prevent_default: bool);
}
Available on web_platform only.

Required Methods§

source

fn canvas(&self) -> Option<HtmlCanvasElement>

Only returns the canvas if called from inside the window context (the main thread).

source

fn prevent_default(&self) -> bool

Returns true if calling event.preventDefault() is enabled.

See Window::set_prevent_default() for more details.

source

fn set_prevent_default(&self, prevent_default: bool)

Sets whether event.preventDefault() should be called on events on the canvas that have side effects.

For example, by default using the mouse wheel would cause the page to scroll, enabling this would prevent that.

Some events are impossible to prevent. E.g. Firefox allows to access the native browser context menu with Shift+Rightclick.

Implementors§