summaryrefslogtreecommitdiffstats
path: root/native/src/touch.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-12-15 06:13:19 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-12-15 06:13:19 +0100
commit09110a93b06ae33af6870b4aded8637748cecace (patch)
tree64f4d9a4dde51ef44ea47f94c2079e5346df4c6c /native/src/touch.rs
parenta42b3c6998274e75fd10f5ff3cecbdb37b9e3895 (diff)
parent36bdc0be1a0f959c84c18286b85c1ab51be330e6 (diff)
downloadiced-09110a93b06ae33af6870b4aded8637748cecace.tar.gz
iced-09110a93b06ae33af6870b4aded8637748cecace.tar.bz2
iced-09110a93b06ae33af6870b4aded8637748cecace.zip
Merge branch 'ios-support-wip' into feature/touch-support
Diffstat (limited to 'native/src/touch.rs')
-rw-r--r--native/src/touch.rs35
1 files changed, 35 insertions, 0 deletions
diff --git a/native/src/touch.rs b/native/src/touch.rs
new file mode 100644
index 00000000..88bd83bb
--- /dev/null
+++ b/native/src/touch.rs
@@ -0,0 +1,35 @@
+//! Build touch events.
+use crate::Point;
+
+/// A touch interaction.
+#[derive(Debug, Clone, Copy, PartialEq)]
+pub struct Touch {
+ /// The finger of the touch.
+ pub finger: Finger,
+
+ /// The position of the touch.
+ pub position: Point,
+
+ /// The state of the touch.
+ pub phase: Phase,
+}
+
+/// A unique identifier representing a finger on a touch interaction.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
+pub struct Finger(pub u64);
+
+/// The state of a touch interaction.
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub enum Phase {
+ /// A touch interaction was started.
+ Started,
+
+ /// An on-going touch interaction was moved.
+ Moved,
+
+ /// A touch interaction was ended.
+ Ended,
+
+ /// A touch interaction was canceled.
+ Canceled,
+}