Web: Implement MonitorHandle (#3801)
Requires getting permission from the user to get "detailed" support. Also enables users to go fullscreen on specific monitors. Exposes platform-specific orientation API. Most functionality depends on browser support, currently only Chromium.
This commit is contained in:
parent
2e97ab3d4f
commit
a0bc3e5dc8
21 changed files with 1493 additions and 120 deletions
|
|
@ -4,7 +4,7 @@ use dpi::{LogicalPosition, PhysicalPosition, Position};
|
|||
use smol_str::SmolStr;
|
||||
use wasm_bindgen::prelude::wasm_bindgen;
|
||||
use wasm_bindgen::{JsCast, JsValue};
|
||||
use web_sys::{KeyboardEvent, MouseEvent, PointerEvent, WheelEvent};
|
||||
use web_sys::{KeyboardEvent, MouseEvent, Navigator, PointerEvent, WheelEvent};
|
||||
|
||||
use super::Engine;
|
||||
use crate::event::{MouseButton, MouseScrollDelta};
|
||||
|
|
@ -108,8 +108,8 @@ pub enum MouseDelta {
|
|||
}
|
||||
|
||||
impl MouseDelta {
|
||||
pub fn init(window: &web_sys::Window, event: &PointerEvent) -> Self {
|
||||
match super::engine(window) {
|
||||
pub fn init(navigator: &Navigator, event: &PointerEvent) -> Self {
|
||||
match super::engine(navigator) {
|
||||
Some(Engine::Chromium) => Self::Chromium,
|
||||
// Firefox has wrong movement values in coalesced events.
|
||||
Some(Engine::Gecko) if has_coalesced_events_support(event) => Self::Gecko {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue