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