address comments
This commit is contained in:
7 files changed
+41
-46
No files matched your search
Vendored
+2
-2
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"editor.formatOnSave": false,
|
||||
"editor.formatOnSave": true,
|
||||
"[toml]": {
|
||||
"editor.formatOnSave": false
|
||||
},
|
||||
"[rust]": {
|
||||
"editor.defaultFormatter": "DioxusLabs.dioxus"
|
||||
"editor.defaultFormatter": "rust-lang.rust-analyzer"
|
||||
},
|
||||
"rust-analyzer.checkOnSave.allTargets": false,
|
||||
}
|
||||
@@ -7,22 +7,6 @@ use crate::point_interaction::{PointData, PointInteraction};
|
||||
/// A synthetic event that wraps a web-style [`PointerEvent`](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent)
|
||||
pub type PointerEvent = Event<PointerData>;
|
||||
|
||||
/// Data associated with a pointer event, aside from the data shared with mouse events
|
||||
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct PointerEventData {
|
||||
pub pointer_id: i32,
|
||||
pub width: i32,
|
||||
pub height: i32,
|
||||
pub pressure: f32,
|
||||
pub tangential_pressure: f32,
|
||||
pub tilt_x: i32,
|
||||
pub tilt_y: i32,
|
||||
pub twist: i32,
|
||||
pub pointer_type: String,
|
||||
pub is_primary: bool,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct PointerData {
|
||||
@@ -105,20 +89,33 @@ impl_event![
|
||||
];
|
||||
|
||||
impl PointerData {
|
||||
pub fn new(point_data: PointData, pointer_event_data: PointerEventData) -> Self {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
point_data: PointData,
|
||||
pointer_id: i32,
|
||||
width: i32,
|
||||
height: i32,
|
||||
pressure: f32,
|
||||
tangential_pressure: f32,
|
||||
tilt_x: i32,
|
||||
tilt_y: i32,
|
||||
twist: i32,
|
||||
pointer_type: String,
|
||||
is_primary: bool,
|
||||
) -> Self {
|
||||
#[allow(deprecated)]
|
||||
Self {
|
||||
point_data,
|
||||
pointer_id: pointer_event_data.pointer_id,
|
||||
width: pointer_event_data.width,
|
||||
height: pointer_event_data.height,
|
||||
pressure: pointer_event_data.pressure,
|
||||
tangential_pressure: pointer_event_data.tangential_pressure,
|
||||
tilt_x: pointer_event_data.tilt_x,
|
||||
tilt_y: pointer_event_data.tilt_y,
|
||||
twist: pointer_event_data.twist,
|
||||
pointer_type: pointer_event_data.pointer_type,
|
||||
is_primary: pointer_event_data.is_primary,
|
||||
pointer_id,
|
||||
width,
|
||||
height,
|
||||
pressure,
|
||||
tangential_pressure,
|
||||
tilt_x,
|
||||
tilt_y,
|
||||
twist,
|
||||
pointer_type,
|
||||
is_primary,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@ pub use transit::*;
|
||||
pub use elements::*;
|
||||
pub use events::*;
|
||||
pub use global_attributes::*;
|
||||
pub use point_interaction::PointInteraction;
|
||||
pub use render_template::*;
|
||||
|
||||
mod eval;
|
||||
@@ -44,4 +43,5 @@ mod eval;
|
||||
pub mod prelude {
|
||||
pub use crate::eval::*;
|
||||
pub use crate::events::*;
|
||||
pub use crate::point_interaction::PointInteraction;
|
||||
}
|
||||
@@ -4,7 +4,7 @@ use crate::events::{
|
||||
};
|
||||
use crate::input_data::decode_key_location;
|
||||
use crate::point_interaction::PointData;
|
||||
use crate::{DragData, MountedData, PointerEventData};
|
||||
use crate::{DragData, MountedData};
|
||||
use keyboard_types::{Code, Key, Modifiers};
|
||||
use std::convert::TryInto;
|
||||
use std::str::FromStr;
|
||||
@@ -147,18 +147,16 @@ impl From<&PointerEvent> for PointerData {
|
||||
page_x: e.page_x(),
|
||||
page_y: e.page_y(),
|
||||
},
|
||||
PointerEventData {
|
||||
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(),
|
||||
},
|
||||
e.pointer_id(),
|
||||
e.width(),
|
||||
e.height(),
|
||||
e.pressure(),
|
||||
e.tangential_pressure(),
|
||||
e.tilt_x(),
|
||||
e.tilt_y(),
|
||||
e.twist(),
|
||||
e.pointer_type(),
|
||||
e.is_primary(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ use dioxus_html::input_data::{
|
||||
MouseButton as DioxusMouseButton, MouseButtonSet as DioxusMouseButtons,
|
||||
};
|
||||
use dioxus_html::point_interaction::PointData;
|
||||
use dioxus_html::{event_bubbles, FocusData, KeyboardData, MouseData, PointInteraction, WheelData};
|
||||
use dioxus_html::{event_bubbles, FocusData, KeyboardData, MouseData, prelude::PointInteraction, WheelData};
|
||||
use std::any::Any;
|
||||
use std::collections::HashMap;
|
||||
use std::{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use dioxus_html::{input_data::keyboard_types::Key, KeyboardData, MouseData, PointInteraction};
|
||||
use dioxus_html::{input_data::keyboard_types::Key, KeyboardData, MouseData, prelude::PointInteraction};
|
||||
use dioxus_native_core::{
|
||||
custom_element::CustomElement,
|
||||
node::{OwnedAttributeDiscription, OwnedAttributeValue},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use std::{collections::HashMap, io::stdout};
|
||||
|
||||
use crossterm::{cursor::MoveTo, execute};
|
||||
use dioxus_html::{input_data::keyboard_types::Key, KeyboardData, MouseData, PointInteraction};
|
||||
use dioxus_html::{input_data::keyboard_types::Key, KeyboardData, MouseData, prelude::PointInteraction};
|
||||
use dioxus_native_core::{
|
||||
custom_element::CustomElement,
|
||||
node::OwnedAttributeDiscription,
|
||||
|
||||
Reference in new issue
Block a user