|
@@ -1,17 +1,17 @@
|
|
|
|
+use crate::events::HasKeyboardData;
|
|
use crate::events::{
|
|
use crate::events::{
|
|
AnimationData, CompositionData, KeyboardData, MouseData, PointerData, TouchData,
|
|
AnimationData, CompositionData, KeyboardData, MouseData, PointerData, TouchData,
|
|
TransitionData, WheelData,
|
|
TransitionData, WheelData,
|
|
};
|
|
};
|
|
-use crate::geometry::{ClientPoint, Coordinates, ElementPoint, PagePoint, ScreenPoint};
|
|
|
|
|
|
+use crate::geometry::{ClientPoint, ElementPoint, PagePoint, ScreenPoint};
|
|
use crate::input_data::{decode_key_location, decode_mouse_button_set, MouseButton};
|
|
use crate::input_data::{decode_key_location, decode_mouse_button_set, MouseButton};
|
|
-use crate::{DragData, MountedData};
|
|
|
|
|
|
+use crate::prelude::*;
|
|
use keyboard_types::{Code, Key, Modifiers};
|
|
use keyboard_types::{Code, Key, Modifiers};
|
|
-use std::convert::TryInto;
|
|
|
|
use std::str::FromStr;
|
|
use std::str::FromStr;
|
|
use wasm_bindgen::{JsCast, JsValue};
|
|
use wasm_bindgen::{JsCast, JsValue};
|
|
use web_sys::{
|
|
use web_sys::{
|
|
- AnimationEvent, CompositionEvent, Event, KeyboardEvent, MouseEvent, PointerEvent, TouchEvent,
|
|
|
|
- TransitionEvent, WheelEvent,
|
|
|
|
|
|
+ AnimationEvent, CompositionEvent, Event, KeyboardEvent, MouseEvent, PointerEvent, Touch,
|
|
|
|
+ TouchEvent, TransitionEvent, WheelEvent,
|
|
};
|
|
};
|
|
|
|
|
|
macro_rules! uncheck_convert {
|
|
macro_rules! uncheck_convert {
|
|
@@ -20,7 +20,7 @@ macro_rules! uncheck_convert {
|
|
#[inline]
|
|
#[inline]
|
|
fn from(e: Event) -> Self {
|
|
fn from(e: Event) -> Self {
|
|
let e: $t = e.unchecked_into();
|
|
let e: $t = e.unchecked_into();
|
|
- Self::from(&e)
|
|
|
|
|
|
+ Self::from(e)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -28,7 +28,7 @@ macro_rules! uncheck_convert {
|
|
#[inline]
|
|
#[inline]
|
|
fn from(e: &Event) -> Self {
|
|
fn from(e: &Event) -> Self {
|
|
let e: &$t = e.unchecked_ref();
|
|
let e: &$t = e.unchecked_ref();
|
|
- Self::from(e)
|
|
|
|
|
|
+ Self::from(e.clone())
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -38,159 +38,368 @@ macro_rules! uncheck_convert {
|
|
}
|
|
}
|
|
|
|
|
|
uncheck_convert![
|
|
uncheck_convert![
|
|
- CompositionEvent => CompositionData,
|
|
|
|
- KeyboardEvent => KeyboardData,
|
|
|
|
- MouseEvent => MouseData,
|
|
|
|
- MouseEvent => DragData,
|
|
|
|
- TouchEvent => TouchData,
|
|
|
|
- PointerEvent => PointerData,
|
|
|
|
- WheelEvent => WheelData,
|
|
|
|
- AnimationEvent => AnimationData,
|
|
|
|
- TransitionEvent => TransitionData,
|
|
|
|
|
|
+ web_sys::CompositionEvent => CompositionData,
|
|
|
|
+ web_sys::KeyboardEvent => KeyboardData,
|
|
|
|
+ web_sys::MouseEvent => MouseData,
|
|
|
|
+ web_sys::TouchEvent => TouchData,
|
|
|
|
+ web_sys::PointerEvent => PointerData,
|
|
|
|
+ web_sys::WheelEvent => WheelData,
|
|
|
|
+ web_sys::AnimationEvent => AnimationData,
|
|
|
|
+ web_sys::TransitionEvent => TransitionData,
|
|
|
|
+ web_sys::MouseEvent => DragData,
|
|
|
|
+ web_sys::FocusEvent => FocusData,
|
|
];
|
|
];
|
|
|
|
|
|
-impl From<&CompositionEvent> for CompositionData {
|
|
|
|
- fn from(e: &CompositionEvent) -> Self {
|
|
|
|
- Self {
|
|
|
|
- data: e.data().unwrap_or_default(),
|
|
|
|
- }
|
|
|
|
|
|
+impl HasCompositionData for CompositionEvent {
|
|
|
|
+ fn data(&self) -> std::string::String {
|
|
|
|
+ self.data().unwrap_or_default()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn as_any(&self) -> &dyn std::any::Any {
|
|
|
|
+ self
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-impl From<&KeyboardEvent> for KeyboardData {
|
|
|
|
- fn from(e: &KeyboardEvent) -> Self {
|
|
|
|
|
|
+impl HasKeyboardData for KeyboardEvent {
|
|
|
|
+ fn key(&self) -> Key {
|
|
|
|
+ Key::from_str(self.key().as_str()).unwrap_or(Key::Unidentified)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn code(&self) -> Code {
|
|
|
|
+ Code::from_str(self.code().as_str()).unwrap_or(Code::Unidentified)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn location(&self) -> keyboard_types::Location {
|
|
|
|
+ decode_key_location(self.location() as usize)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn is_auto_repeating(&self) -> bool {
|
|
|
|
+ self.repeat()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn as_any(&self) -> &dyn std::any::Any {
|
|
|
|
+ self
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+impl ModifiersInteraction for KeyboardEvent {
|
|
|
|
+ fn modifiers(&self) -> Modifiers {
|
|
let mut modifiers = Modifiers::empty();
|
|
let mut modifiers = Modifiers::empty();
|
|
|
|
|
|
- if e.alt_key() {
|
|
|
|
|
|
+ if self.alt_key() {
|
|
modifiers.insert(Modifiers::ALT);
|
|
modifiers.insert(Modifiers::ALT);
|
|
}
|
|
}
|
|
- if e.ctrl_key() {
|
|
|
|
|
|
+ if self.ctrl_key() {
|
|
modifiers.insert(Modifiers::CONTROL);
|
|
modifiers.insert(Modifiers::CONTROL);
|
|
}
|
|
}
|
|
- if e.meta_key() {
|
|
|
|
|
|
+ if self.meta_key() {
|
|
modifiers.insert(Modifiers::META);
|
|
modifiers.insert(Modifiers::META);
|
|
}
|
|
}
|
|
- if e.shift_key() {
|
|
|
|
|
|
+ if self.shift_key() {
|
|
modifiers.insert(Modifiers::SHIFT);
|
|
modifiers.insert(Modifiers::SHIFT);
|
|
}
|
|
}
|
|
|
|
|
|
- Self::new(
|
|
|
|
- Key::from_str(&e.key()).expect("could not parse key"),
|
|
|
|
- Code::from_str(&e.code()).expect("could not parse code"),
|
|
|
|
- decode_key_location(
|
|
|
|
- e.location()
|
|
|
|
- .try_into()
|
|
|
|
- .expect("could not convert location to u32"),
|
|
|
|
- ),
|
|
|
|
- e.repeat(),
|
|
|
|
- modifiers,
|
|
|
|
- )
|
|
|
|
|
|
+ modifiers
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-impl From<&MouseEvent> for MouseData {
|
|
|
|
- fn from(e: &MouseEvent) -> Self {
|
|
|
|
|
|
+impl HasDragData for MouseEvent {}
|
|
|
|
+
|
|
|
|
+impl InteractionLocation for MouseEvent {
|
|
|
|
+ fn client_coordinates(&self) -> ClientPoint {
|
|
|
|
+ ClientPoint::new(self.client_x().into(), self.client_y().into())
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn page_coordinates(&self) -> PagePoint {
|
|
|
|
+ PagePoint::new(self.page_x().into(), self.page_y().into())
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn screen_coordinates(&self) -> ScreenPoint {
|
|
|
|
+ ScreenPoint::new(self.screen_x().into(), self.screen_y().into())
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+impl InteractionElementOffset for MouseEvent {
|
|
|
|
+ fn element_coordinates(&self) -> ElementPoint {
|
|
|
|
+ ElementPoint::new(self.offset_x().into(), self.offset_y().into())
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+impl ModifiersInteraction for MouseEvent {
|
|
|
|
+ fn modifiers(&self) -> Modifiers {
|
|
let mut modifiers = Modifiers::empty();
|
|
let mut modifiers = Modifiers::empty();
|
|
|
|
|
|
- if e.alt_key() {
|
|
|
|
|
|
+ if self.alt_key() {
|
|
modifiers.insert(Modifiers::ALT);
|
|
modifiers.insert(Modifiers::ALT);
|
|
}
|
|
}
|
|
- if e.ctrl_key() {
|
|
|
|
|
|
+ if self.ctrl_key() {
|
|
modifiers.insert(Modifiers::CONTROL);
|
|
modifiers.insert(Modifiers::CONTROL);
|
|
}
|
|
}
|
|
- if e.meta_key() {
|
|
|
|
|
|
+ if self.meta_key() {
|
|
modifiers.insert(Modifiers::META);
|
|
modifiers.insert(Modifiers::META);
|
|
}
|
|
}
|
|
- if e.shift_key() {
|
|
|
|
|
|
+ if self.shift_key() {
|
|
modifiers.insert(Modifiers::SHIFT);
|
|
modifiers.insert(Modifiers::SHIFT);
|
|
}
|
|
}
|
|
|
|
|
|
- MouseData::new(
|
|
|
|
- Coordinates::new(
|
|
|
|
- ScreenPoint::new(e.screen_x().into(), e.screen_y().into()),
|
|
|
|
- ClientPoint::new(e.client_x().into(), e.client_y().into()),
|
|
|
|
- ElementPoint::new(e.offset_x().into(), e.offset_y().into()),
|
|
|
|
- PagePoint::new(e.page_x().into(), e.page_y().into()),
|
|
|
|
- ),
|
|
|
|
- Some(MouseButton::from_web_code(e.button())),
|
|
|
|
- decode_mouse_button_set(e.buttons()),
|
|
|
|
- modifiers,
|
|
|
|
- )
|
|
|
|
|
|
+ modifiers
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-impl From<&MouseEvent> for DragData {
|
|
|
|
- fn from(value: &MouseEvent) -> Self {
|
|
|
|
- Self {
|
|
|
|
- mouse: MouseData::from(value),
|
|
|
|
- }
|
|
|
|
|
|
+impl PointerInteraction for MouseEvent {
|
|
|
|
+ fn held_buttons(&self) -> crate::input_data::MouseButtonSet {
|
|
|
|
+ decode_mouse_button_set(self.buttons())
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn trigger_button(&self) -> Option<MouseButton> {
|
|
|
|
+ Some(MouseButton::from_web_code(self.button()))
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+impl HasMouseData for MouseEvent {
|
|
|
|
+ fn as_any(&self) -> &dyn std::any::Any {
|
|
|
|
+ self
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-impl From<&TouchEvent> for TouchData {
|
|
|
|
- fn from(e: &TouchEvent) -> Self {
|
|
|
|
- Self {
|
|
|
|
- alt_key: e.alt_key(),
|
|
|
|
- ctrl_key: e.ctrl_key(),
|
|
|
|
- meta_key: e.meta_key(),
|
|
|
|
- shift_key: e.shift_key(),
|
|
|
|
|
|
+impl ModifiersInteraction for TouchEvent {
|
|
|
|
+ fn modifiers(&self) -> Modifiers {
|
|
|
|
+ let mut modifiers = Modifiers::empty();
|
|
|
|
+
|
|
|
|
+ if self.alt_key() {
|
|
|
|
+ modifiers.insert(Modifiers::ALT);
|
|
}
|
|
}
|
|
|
|
+ if self.ctrl_key() {
|
|
|
|
+ modifiers.insert(Modifiers::CONTROL);
|
|
|
|
+ }
|
|
|
|
+ if self.meta_key() {
|
|
|
|
+ modifiers.insert(Modifiers::META);
|
|
|
|
+ }
|
|
|
|
+ if self.shift_key() {
|
|
|
|
+ modifiers.insert(Modifiers::SHIFT);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ modifiers
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-impl From<&PointerEvent> for PointerData {
|
|
|
|
- fn from(e: &PointerEvent) -> Self {
|
|
|
|
- Self {
|
|
|
|
- alt_key: e.alt_key(),
|
|
|
|
- button: e.button(),
|
|
|
|
- buttons: e.buttons(),
|
|
|
|
- client_x: e.client_x(),
|
|
|
|
- client_y: e.client_y(),
|
|
|
|
- ctrl_key: e.ctrl_key(),
|
|
|
|
- meta_key: e.meta_key(),
|
|
|
|
- page_x: e.page_x(),
|
|
|
|
- page_y: e.page_y(),
|
|
|
|
- screen_x: e.screen_x(),
|
|
|
|
- screen_y: e.screen_y(),
|
|
|
|
- shift_key: e.shift_key(),
|
|
|
|
- pointer_id: e.pointer_id(),
|
|
|
|
- width: e.width(),
|
|
|
|
- height: e.height(),
|
|
|
|
- pressure: e.pressure(),
|
|
|
|
- tangential_pressure: e.tangential_pressure(),
|
|
|
|
- tilt_x: e.tilt_x(),
|
|
|
|
- tilt_y: e.tilt_y(),
|
|
|
|
- twist: e.twist(),
|
|
|
|
- pointer_type: e.pointer_type(),
|
|
|
|
- is_primary: e.is_primary(),
|
|
|
|
- // get_modifier_state: evt.get_modifier_state(),
|
|
|
|
|
|
+impl crate::events::HasTouchData for TouchEvent {
|
|
|
|
+ fn touches(&self) -> Vec<TouchPoint> {
|
|
|
|
+ let touches = TouchEvent::touches(self);
|
|
|
|
+ let mut result = Vec::with_capacity(touches.length() as usize);
|
|
|
|
+ for i in 0..touches.length() {
|
|
|
|
+ let touch = touches.get(i).unwrap();
|
|
|
|
+ result.push(TouchPoint::new(touch));
|
|
|
|
+ }
|
|
|
|
+ result
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn touches_changed(&self) -> Vec<TouchPoint> {
|
|
|
|
+ let touches = self.changed_touches();
|
|
|
|
+ let mut result = Vec::with_capacity(touches.length() as usize);
|
|
|
|
+ for i in 0..touches.length() {
|
|
|
|
+ let touch = touches.get(i).unwrap();
|
|
|
|
+ result.push(TouchPoint::new(touch));
|
|
|
|
+ }
|
|
|
|
+ result
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn target_touches(&self) -> Vec<TouchPoint> {
|
|
|
|
+ let touches = self.target_touches();
|
|
|
|
+ let mut result = Vec::with_capacity(touches.length() as usize);
|
|
|
|
+ for i in 0..touches.length() {
|
|
|
|
+ let touch = touches.get(i).unwrap();
|
|
|
|
+ result.push(TouchPoint::new(touch));
|
|
}
|
|
}
|
|
|
|
+ result
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn as_any(&self) -> &dyn std::any::Any {
|
|
|
|
+ self
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-impl From<&WheelEvent> for WheelData {
|
|
|
|
- fn from(e: &WheelEvent) -> Self {
|
|
|
|
- WheelData::from_web_attributes(e.delta_mode(), e.delta_x(), e.delta_y(), e.delta_z())
|
|
|
|
|
|
+impl HasTouchPointData for Touch {
|
|
|
|
+ fn identifier(&self) -> i32 {
|
|
|
|
+ self.identifier()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn radius(&self) -> ScreenPoint {
|
|
|
|
+ ScreenPoint::new(self.radius_x().into(), self.radius_y().into())
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn rotation(&self) -> f64 {
|
|
|
|
+ self.rotation_angle() as f64
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn force(&self) -> f64 {
|
|
|
|
+ self.force() as f64
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn as_any(&self) -> &dyn std::any::Any {
|
|
|
|
+ self
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-impl From<&AnimationEvent> for AnimationData {
|
|
|
|
- fn from(e: &AnimationEvent) -> Self {
|
|
|
|
- Self {
|
|
|
|
- elapsed_time: e.elapsed_time(),
|
|
|
|
- animation_name: e.animation_name(),
|
|
|
|
- pseudo_element: e.pseudo_element(),
|
|
|
|
- }
|
|
|
|
|
|
+impl InteractionLocation for Touch {
|
|
|
|
+ fn client_coordinates(&self) -> ClientPoint {
|
|
|
|
+ ClientPoint::new(self.client_x().into(), self.client_y().into())
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn screen_coordinates(&self) -> ScreenPoint {
|
|
|
|
+ ScreenPoint::new(self.screen_x().into(), self.screen_y().into())
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn page_coordinates(&self) -> PagePoint {
|
|
|
|
+ PagePoint::new(self.page_x().into(), self.page_y().into())
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-impl From<&TransitionEvent> for TransitionData {
|
|
|
|
- fn from(e: &TransitionEvent) -> Self {
|
|
|
|
- Self {
|
|
|
|
- elapsed_time: e.elapsed_time(),
|
|
|
|
- property_name: e.property_name(),
|
|
|
|
- pseudo_element: e.pseudo_element(),
|
|
|
|
|
|
+impl HasPointerData for PointerEvent {
|
|
|
|
+ fn pointer_id(&self) -> i32 {
|
|
|
|
+ self.pointer_id()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn width(&self) -> i32 {
|
|
|
|
+ self.width()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn height(&self) -> i32 {
|
|
|
|
+ self.height()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn pressure(&self) -> f32 {
|
|
|
|
+ self.pressure()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn tangential_pressure(&self) -> f32 {
|
|
|
|
+ self.tangential_pressure()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn tilt_x(&self) -> i32 {
|
|
|
|
+ self.tilt_x()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn tilt_y(&self) -> i32 {
|
|
|
|
+ self.tilt_y()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn twist(&self) -> i32 {
|
|
|
|
+ self.twist()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn pointer_type(&self) -> String {
|
|
|
|
+ self.pointer_type()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn is_primary(&self) -> bool {
|
|
|
|
+ self.is_primary()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn as_any(&self) -> &dyn std::any::Any {
|
|
|
|
+ self
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+impl InteractionLocation for PointerEvent {
|
|
|
|
+ fn client_coordinates(&self) -> ClientPoint {
|
|
|
|
+ ClientPoint::new(self.client_x().into(), self.client_y().into())
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn screen_coordinates(&self) -> ScreenPoint {
|
|
|
|
+ ScreenPoint::new(self.screen_x().into(), self.screen_y().into())
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn page_coordinates(&self) -> PagePoint {
|
|
|
|
+ PagePoint::new(self.page_x().into(), self.page_y().into())
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+impl InteractionElementOffset for PointerEvent {
|
|
|
|
+ fn element_coordinates(&self) -> ElementPoint {
|
|
|
|
+ ElementPoint::new(self.offset_x().into(), self.offset_y().into())
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+impl ModifiersInteraction for PointerEvent {
|
|
|
|
+ fn modifiers(&self) -> Modifiers {
|
|
|
|
+ let mut modifiers = Modifiers::empty();
|
|
|
|
+
|
|
|
|
+ if self.alt_key() {
|
|
|
|
+ modifiers.insert(Modifiers::ALT);
|
|
|
|
+ }
|
|
|
|
+ if self.ctrl_key() {
|
|
|
|
+ modifiers.insert(Modifiers::CONTROL);
|
|
}
|
|
}
|
|
|
|
+ if self.meta_key() {
|
|
|
|
+ modifiers.insert(Modifiers::META);
|
|
|
|
+ }
|
|
|
|
+ if self.shift_key() {
|
|
|
|
+ modifiers.insert(Modifiers::SHIFT);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ modifiers
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+impl PointerInteraction for PointerEvent {
|
|
|
|
+ fn held_buttons(&self) -> crate::input_data::MouseButtonSet {
|
|
|
|
+ decode_mouse_button_set(self.buttons())
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn trigger_button(&self) -> Option<MouseButton> {
|
|
|
|
+ Some(MouseButton::from_web_code(self.button()))
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+impl HasWheelData for WheelEvent {
|
|
|
|
+ fn delta(&self) -> crate::geometry::WheelDelta {
|
|
|
|
+ crate::geometry::WheelDelta::from_web_attributes(
|
|
|
|
+ self.delta_mode(),
|
|
|
|
+ self.delta_x(),
|
|
|
|
+ self.delta_y(),
|
|
|
|
+ self.delta_z(),
|
|
|
|
+ )
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn as_any(&self) -> &dyn std::any::Any {
|
|
|
|
+ self
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+impl HasAnimationData for AnimationEvent {
|
|
|
|
+ fn animation_name(&self) -> String {
|
|
|
|
+ self.animation_name()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn pseudo_element(&self) -> String {
|
|
|
|
+ self.pseudo_element()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn elapsed_time(&self) -> f32 {
|
|
|
|
+ self.elapsed_time()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn as_any(&self) -> &dyn std::any::Any {
|
|
|
|
+ self
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+impl HasTransitionData for TransitionEvent {
|
|
|
|
+ fn elapsed_time(&self) -> f32 {
|
|
|
|
+ self.elapsed_time()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn property_name(&self) -> String {
|
|
|
|
+ self.property_name()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn pseudo_element(&self) -> String {
|
|
|
|
+ self.pseudo_element()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn as_any(&self) -> &dyn std::any::Any {
|
|
|
|
+ self
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -216,8 +425,8 @@ impl crate::RenderedElementBacking for web_sys::Element {
|
|
Box::pin(async { result })
|
|
Box::pin(async { result })
|
|
}
|
|
}
|
|
|
|
|
|
- fn get_raw_element(&self) -> crate::MountedResult<&dyn std::any::Any> {
|
|
|
|
- Ok(self)
|
|
|
|
|
|
+ fn as_any(&self) -> &dyn std::any::Any {
|
|
|
|
+ self
|
|
}
|
|
}
|
|
|
|
|
|
fn scroll_to(
|
|
fn scroll_to(
|
|
@@ -261,3 +470,45 @@ impl std::fmt::Display for FocusError {
|
|
}
|
|
}
|
|
|
|
|
|
impl std::error::Error for FocusError {}
|
|
impl std::error::Error for FocusError {}
|
|
|
|
+
|
|
|
|
+impl HasScrollData for Event {
|
|
|
|
+ fn as_any(&self) -> &dyn std::any::Any {
|
|
|
|
+ self
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+impl HasClipboardData for Event {
|
|
|
|
+ fn as_any(&self) -> &dyn std::any::Any {
|
|
|
|
+ self
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+impl From<&Event> for ClipboardData {
|
|
|
|
+ fn from(e: &Event) -> Self {
|
|
|
|
+ ClipboardData::new(e.clone())
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+impl HasFocusData for web_sys::FocusEvent {
|
|
|
|
+ fn as_any(&self) -> &dyn std::any::Any {
|
|
|
|
+ self
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+impl HasToggleData for web_sys::Event {
|
|
|
|
+ fn as_any(&self) -> &dyn std::any::Any {
|
|
|
|
+ self
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+impl HasSelectionData for web_sys::Event {
|
|
|
|
+ fn as_any(&self) -> &dyn std::any::Any {
|
|
|
|
+ self
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+impl HasMediaData for web_sys::Event {
|
|
|
|
+ fn as_any(&self) -> &dyn std::any::Any {
|
|
|
|
+ self
|
|
|
|
+ }
|
|
|
|
+}
|