mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
add cancelable
property to the TouchEvent
(#35713)
* add `cancelable` property to the `TouchEvent` set cancellable = false when sending move events to script, if the first touch_move event did not cancel it Signed-off-by: kongbai1996 <1782765876@qq.com> * modified review commentss Signed-off-by: kongbai1996 <1782765876@qq.com> --------- Signed-off-by: kongbai1996 <1782765876@qq.com>
This commit is contained in:
parent
67bd557f30
commit
929f87f598
3 changed files with 17 additions and 2 deletions
|
@ -147,6 +147,8 @@ pub struct TouchEvent {
|
|||
pub event_type: TouchEventType,
|
||||
pub id: TouchId,
|
||||
pub point: DevicePoint,
|
||||
/// cancelable default value is true, once the first move has been processed by script disable it.
|
||||
cancelable: bool,
|
||||
/// The sequence_id will be set by servo's touch handler.
|
||||
sequence_id: Option<TouchSequenceId>,
|
||||
}
|
||||
|
@ -158,6 +160,7 @@ impl TouchEvent {
|
|||
id,
|
||||
point,
|
||||
sequence_id: None,
|
||||
cancelable: true,
|
||||
}
|
||||
}
|
||||
/// Embedders should ignore this.
|
||||
|
@ -175,6 +178,16 @@ impl TouchEvent {
|
|||
pub fn expect_sequence_id(&self) -> TouchSequenceId {
|
||||
self.sequence_id.expect("Sequence ID not initialized")
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub fn disable_cancelable(&mut self) {
|
||||
self.cancelable = false;
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub fn is_cancelable(&self) -> bool {
|
||||
self.cancelable
|
||||
}
|
||||
}
|
||||
|
||||
/// Mode to measure WheelDelta floats in
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue