Skip to content

Commit

Permalink
Improve documentation of WindowBuilderExtWebSys methods (rust-windo…
Browse files Browse the repository at this point in the history
  • Loading branch information
daxpedda authored Jul 12, 2023
1 parent d7ec899 commit 5b5ebc2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/platform/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ pub trait WindowExtWebSys {
}

pub trait WindowBuilderExtWebSys {
/// Pass an [`HtmlCanvasElement`] to be used for this [`Window`](crate::window::Window). If
/// [`None`], [`WindowBuilder::build()`] will create one.
///
/// In any case, the canvas won't be automatically inserted into the web page.
///
/// [`None`] by default.
fn with_canvas(self, canvas: Option<HtmlCanvasElement>) -> Self;

/// Whether `event.preventDefault` should be automatically called to prevent event propagation
Expand All @@ -51,10 +57,14 @@ pub trait WindowBuilderExtWebSys {
///
/// Some events are impossible to prevent. E.g. Firefox allows to access the native browser
/// context menu with Shift+Rightclick.
///
/// Enabled by default.
fn with_prevent_default(self, prevent_default: bool) -> Self;

/// Whether the canvas should be focusable using the tab key. This is necessary to capture
/// canvas keyboard events.
///
/// Enabled by default.
fn with_focusable(self, focusable: bool) -> Self;
}

Expand Down

0 comments on commit 5b5ebc2

Please sign in to comment.