pub struct GestureArena { /* private fields */ }Expand description
多个识别器竞争同一指针:
- 每个识别器初始
Possible - 事件喂给所有未决识别器
- 第一个返回
Accepted的胜出,其余dispose(强制 Rejected) - 胜出者独占后续事件,直到
PointerUp(手势结束,重置)
Implementations§
Source§impl GestureArena
impl GestureArena
pub fn new(recognizers: Vec<Box<dyn GestureRecognizer>>) -> Self
Sourcepub fn adopt_callbacks(&mut self, fresh: GestureArena)
pub fn adopt_callbacks(&mut self, fresh: GestureArena)
用 fresh 竞技场(从新 widget 构建)刷新回调,保留识别器状态。
识别器按 build_arena 的确定性顺序 index 对齐。识别器集合大小变化
(手势配置改变,如摘掉 on_pan_update)时无法对应 → 整场替换(状态作废)。
pub fn is_empty(&self) -> bool
Sourcepub fn has_winner(&self) -> bool
pub fn has_winner(&self) -> bool
竞技场是否有已胜出的持续型手势(外部仲裁查询用)
Sourcepub fn add_pointer(&mut self, event: &WidgetEvent)
pub fn add_pointer(&mut self, event: &WidgetEvent)
喂指针事件:胜者独占;无胜者全员参与,然后仲裁
Sourcepub fn poll(&mut self)
pub fn poll(&mut self)
时钟推进(每帧由 GestureDetectorState::tick 调)。
长按等“按住超时“类手势没有事件流驱动,靠这里到时触发;
仲裁规则与 add_pointer 相同(第一个 Accepted 胜出,其余 dispose)。
Sourcepub fn dispose_all(&mut self)
pub fn dispose_all(&mut self)
外部否决(竞争失败):全部强制放弃
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for GestureArena
impl !Send for GestureArena
impl !Sync for GestureArena
impl !UnwindSafe for GestureArena
impl Forget for GestureArena
impl Freeze for GestureArena
impl Move for GestureArena
impl Unpin for GestureArena
impl UnsafeUnpin for GestureArena
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more