From 34dd2cdba974c6d490b0d483218d29f2c8799297 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Mon, 25 Dec 2023 00:54:01 +0100 Subject: [PATCH] Doc fixes (#3312) --- src/cursor.rs | 5 ----- src/platform/web.rs | 11 ++++++----- src/window.rs | 2 ++ 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/cursor.rs b/src/cursor.rs index 08ac912d53..c263d79200 100644 --- a/src/cursor.rs +++ b/src/cursor.rs @@ -54,11 +54,6 @@ pub struct CustomCursor { impl CustomCursor { /// Creates a new cursor from an rgba buffer. - /// - /// ## Platform-specific - /// - /// - **Web:** Setting cursor could be delayed due to the creation of `Blob` objects, - /// which are async by nature. pub fn from_rgba( rgba: impl Into>, width: u16, diff --git a/src/platform/web.rs b/src/platform/web.rs index 2d79914924..8062166a9f 100644 --- a/src/platform/web.rs +++ b/src/platform/web.rs @@ -39,7 +39,8 @@ use crate::SendSyncWrapper; use web_sys::HtmlCanvasElement; pub trait WindowExtWebSys { - /// Only returns the canvas if called from inside the window. + /// Only returns the canvas if called from inside the window context (the + /// main thread). fn canvas(&self) -> Option; } @@ -59,11 +60,11 @@ pub trait WindowBuilderExtWebSys { /// [`None`] by default. fn with_canvas(self, canvas: Option) -> Self; - /// Whether `event.preventDefault` should be automatically called to prevent event propagation - /// when appropriate. + /// Whether `event.preventDefault()` should be called on events on the + /// canvas that have side effects. /// - /// For example, mouse wheel events are only handled by the canvas by default. This avoids - /// the default behavior of scrolling the page. + /// 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. diff --git a/src/window.rs b/src/window.rs index 8786435272..89fd0439d6 100644 --- a/src/window.rs +++ b/src/window.rs @@ -1353,6 +1353,8 @@ impl Window { /// ## Platform-specific /// /// - **iOS / Android / Orbital:** Unsupported. + /// - **Web:** Cursor have to be loaded and decoded first, which introduces + /// a delay until cursors are shown. #[inline] pub fn set_custom_cursor(&self, cursor: &CustomCursor) { let cursor = cursor.inner.clone();