mirror of
https://github.com/rust-windowing/winit.git
synced 2026-09-01 14:20:05 -04:00
Doc fixes (#3312)
This commit is contained in:
@@ -54,11 +54,6 @@ pub struct CustomCursor {
|
|||||||
|
|
||||||
impl CustomCursor {
|
impl CustomCursor {
|
||||||
/// Creates a new cursor from an rgba buffer.
|
/// 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(
|
pub fn from_rgba(
|
||||||
rgba: impl Into<Vec<u8>>,
|
rgba: impl Into<Vec<u8>>,
|
||||||
width: u16,
|
width: u16,
|
||||||
|
|||||||
@@ -39,7 +39,8 @@ use crate::SendSyncWrapper;
|
|||||||
use web_sys::HtmlCanvasElement;
|
use web_sys::HtmlCanvasElement;
|
||||||
|
|
||||||
pub trait WindowExtWebSys {
|
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<HtmlCanvasElement>;
|
fn canvas(&self) -> Option<HtmlCanvasElement>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,11 +60,11 @@ pub trait WindowBuilderExtWebSys {
|
|||||||
/// [`None`] by default.
|
/// [`None`] by default.
|
||||||
fn with_canvas(self, canvas: Option<HtmlCanvasElement>) -> Self;
|
fn with_canvas(self, canvas: Option<HtmlCanvasElement>) -> Self;
|
||||||
|
|
||||||
/// Whether `event.preventDefault` should be automatically called to prevent event propagation
|
/// Whether `event.preventDefault()` should be called on events on the
|
||||||
/// when appropriate.
|
/// canvas that have side effects.
|
||||||
///
|
///
|
||||||
/// For example, mouse wheel events are only handled by the canvas by default. This avoids
|
/// For example, by default using the mouse wheel would cause the page to scroll, enabling this
|
||||||
/// the default behavior of scrolling the page.
|
/// would prevent that.
|
||||||
///
|
///
|
||||||
/// Some events are impossible to prevent. E.g. Firefox allows to access the native browser
|
/// Some events are impossible to prevent. E.g. Firefox allows to access the native browser
|
||||||
/// context menu with Shift+Rightclick.
|
/// context menu with Shift+Rightclick.
|
||||||
|
|||||||
@@ -1353,6 +1353,8 @@ impl Window {
|
|||||||
/// ## Platform-specific
|
/// ## Platform-specific
|
||||||
///
|
///
|
||||||
/// - **iOS / Android / Orbital:** Unsupported.
|
/// - **iOS / Android / Orbital:** Unsupported.
|
||||||
|
/// - **Web:** Cursor have to be loaded and decoded first, which introduces
|
||||||
|
/// a delay until cursors are shown.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn set_custom_cursor(&self, cursor: &CustomCursor) {
|
pub fn set_custom_cursor(&self, cursor: &CustomCursor) {
|
||||||
let cursor = cursor.inner.clone();
|
let cursor = cursor.inner.clone();
|
||||||
|
|||||||
Reference in New Issue
Block a user