chore: remove platform FingerId

The same as for `WindowId`.
This commit is contained in:
Kirill Chibisov 2024-10-15 17:26:43 +03:00
parent c8c1eca3c7
commit edfb4b03f4
20 changed files with 71 additions and 172 deletions

View file

@ -1,4 +1,4 @@
use crate::event::{DeviceId, FingerId as RootFingerId};
use crate::event::DeviceId;
pub(crate) fn mkdid(pointer_id: i32) -> Option<DeviceId> {
if let Ok(pointer_id) = u32::try_from(pointer_id) {
@ -10,25 +10,3 @@ pub(crate) fn mkdid(pointer_id: i32) -> Option<DeviceId> {
None
}
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct FingerId {
pointer_id: i32,
}
impl FingerId {
pub fn new(pointer_id: i32) -> Self {
Self { pointer_id }
}
#[cfg(test)]
pub const fn dummy() -> Self {
Self { pointer_id: -1 }
}
}
impl From<FingerId> for RootFingerId {
fn from(id: FingerId) -> Self {
Self(id)
}
}

View file

@ -37,7 +37,6 @@ pub(crate) use cursor::{
CustomCursorSource as PlatformCustomCursorSource,
};
pub use self::event::FingerId;
pub(crate) use self::event_loop::{
ActiveEventLoop, EventLoop, EventLoopProxy, OwnedDisplayHandle,
PlatformSpecificEventLoopAttributes,

View file

@ -6,9 +6,8 @@ use wasm_bindgen::prelude::wasm_bindgen;
use wasm_bindgen::{JsCast, JsValue};
use web_sys::{KeyboardEvent, MouseEvent, Navigator, PointerEvent, WheelEvent};
use super::super::FingerId;
use super::Engine;
use crate::event::{MouseButton, MouseScrollDelta, PointerKind};
use crate::event::{FingerId, MouseButton, MouseScrollDelta, PointerKind};
use crate::keyboard::{Key, KeyLocation, ModifiersState, NamedKey, PhysicalKey};
bitflags::bitflags! {
@ -164,7 +163,7 @@ pub fn mouse_scroll_delta(
pub fn pointer_type(event: &PointerEvent, pointer_id: i32) -> PointerKind {
match event.pointer_type().as_str() {
"mouse" => PointerKind::Mouse,
"touch" => PointerKind::Touch(FingerId::new(pointer_id).into()),
"touch" => PointerKind::Touch(FingerId::from_raw(pointer_id as usize)),
_ => PointerKind::Unknown,
}
}