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:38:46 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-12-15 06:38:46 +0100
commit3bdf931925067acbaabf040f6c437a54640ed1a0 (patch)
tree451ff441ff5272d2612af57b625ce12046574884 /native/src/touch.rs
parent09110a93b06ae33af6870b4aded8637748cecace (diff)
downloadiced-3bdf931925067acbaabf040f6c437a54640ed1a0.tar.gz
iced-3bdf931925067acbaabf040f6c437a54640ed1a0.tar.bz2
iced-3bdf931925067acbaabf040f6c437a54640ed1a0.zip
Turn `Touch` into a `touch::Event` enum
Diffstat (limited to 'native/src/touch.rs')
-rw-r--r--native/src/touch.rs32
1 files changed, 10 insertions, 22 deletions
diff --git a/native/src/touch.rs b/native/src/touch.rs
index 88bd83bb..18120644 100644
--- a/native/src/touch.rs
+++ b/native/src/touch.rs
@@ -3,33 +3,21 @@ 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 {
+#[allow(missing_docs)]
+pub enum Event {
/// A touch interaction was started.
- Started,
+ FingerPressed { id: Finger, position: Point },
/// An on-going touch interaction was moved.
- Moved,
+ FingerMoved { id: Finger, position: Point },
/// A touch interaction was ended.
- Ended,
+ FingerLifted { id: Finger, position: Point },
/// A touch interaction was canceled.
- Canceled,
+ FingerLost { id: Finger, position: Point },
}
+
+/// A unique identifier representing a finger on a touch interaction.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
+pub struct Finger(pub u64);