如何在 sencha touch 中检测双击而不触发 silgeltap

发布于 2024-11-04 17:33:38 字数 68 浏览 0 评论 0原文

有没有一种聪明而简单的方法来检测双击而不触发 sencha touch 中的 silgeltap?

谢谢!

is there a smart and simple way to detect a doubletap without triggering a silgeltap in sencha touch?

thnx!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

想你只要分分秒秒 2024-11-11 17:33:38

我认为没有一种“干净”的方法可以做到这一点。它将延迟单击选项 300 毫秒,这可能是不可接受的。如果可以的话,您可能希望简化 UI 交互。也许点击并按住?

我在 Sencha 中找到了这段代码触摸论坛

setupEventHandlers: function(){
this.mon(this.el, {
    tap: function(e){            
        if(this.delayedTask == null){            
            //setup a delayed task that is called IF double click is not later detected
            this.delayedTask = new Ext.util.DelayedTask(
              function(){
                this.doSomethingInteresting(); 
                this.delayedTask = null;
              }, this);  

            //invoke (with reasonable time to cancel)
            this.delayedTask.delay(300);
        }                
    }, 
    doubletap: function(e){                
        //cancel and clear the queued single click tasks if it's there
        if(this.delayedTask != null){
          this.delayedTask.cancel();
          this.delayedTask = null;
        }                        

        //handle the double click
        this.doSomethingReallyInteresting();
    },        
    scope: this
});

},

I don't think there is a 'clean' way to do it. It will delay the single tap option by 300ms which may be unacceptable. You may want to simplify your UI interactions if you can. Maybe a tap and hold?

I found this code in the Sencha Touch forums.

setupEventHandlers: function(){
this.mon(this.el, {
    tap: function(e){            
        if(this.delayedTask == null){            
            //setup a delayed task that is called IF double click is not later detected
            this.delayedTask = new Ext.util.DelayedTask(
              function(){
                this.doSomethingInteresting(); 
                this.delayedTask = null;
              }, this);  

            //invoke (with reasonable time to cancel)
            this.delayedTask.delay(300);
        }                
    }, 
    doubletap: function(e){                
        //cancel and clear the queued single click tasks if it's there
        if(this.delayedTask != null){
          this.delayedTask.cancel();
          this.delayedTask = null;
        }                        

        //handle the double click
        this.doSomethingReallyInteresting();
    },        
    scope: this
});

},

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文