add touches_changed and target_touches

This commit is contained in:
Evan Almloff committed 2023-09-12 17:45:07 -05:00
1 parent c10700c962
commit 27f4b3f345
2 files changed
+121 -2

No files matched your search

+20
View File
@@ -194,6 +194,26 @@ impl crate::events::HasTouchData for TouchEvent {
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
}