简体   繁体   English

Easeljs-触摸事件在平板电脑和Android中不起作用-但是为什么

[英]Easeljs - touch events are not working in tablet and android - but why

I'm using a framework called easeljs to develop a canvas application - which allows you to draw a freehand shape on the screen. 我正在使用一个名为easyljs的框架来开发画布应用程序-允许您在屏幕上绘制手绘形状。

Its working in desktop, but not in tablet or android. 它适用于台式机,但不适用于平板电脑或android。 Its as if the touch events are not working. 好像触摸事件不起作用。

Works fine in desktop 在桌面上正常工作

this.colourPallette.addEventListener('click', this.palletteHandler);



$('.gs-hamburger').on('click', function(event) {
            event.preventDefault();
            $('.gs-hamburger').toggleClass('gs-close');
            $('#gs-nav-static-hamburger').toggleClass('gs-nav-right-appear');
            $('main,#gs-navfix,#gs-nav-static').toggleClass('gs-nav-right-appear');
            $('#gs-nav-right').toggleClass('gs-appear');
        });

Do I need to unbind the events first - to avoid double triggering? 我是否需要先取消绑定事件-避免双重触发? And then BIND "click touchstart" 然后BIND“点击touchstart”

what about the addEventListener - would I just chain it with 'click touchstart'? 那么addEventListener-我可以将其与“ click touchstart”链接起来吗?

Something like this? 像这样吗

//__clean start
$(".selectorChoice").unbind('touchstart click');


//__ experienced journey selectors
$(".selectorChoice").bind('touchstart click', function(){

    //do other stuff            
    return false;
}); 

Would something like this also work? 这样的事情也行吗? Would I need to integrate touchpunch - or is this only when using jquery ui? 我需要集成touchpunch-还是仅在使用jquery ui时?

this.colourPallette.addEventListener('click touchstart', this.palletteHandler);

Have you enabled touch on the Stage? 您启用了舞台上的触摸功能吗?

createjs.Touch.enable(stage);

This proxies Windows, iOS, and Android touch events to the regular mouse handler methods. 这会将Windows,iOS和Android触摸事件代理为常规的鼠标处理程序方法。

http://www.createjs.com/Docs/EaselJS/classes/Touch.html http://www.createjs.com/Docs/EaselJS/classes/Touch.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM