简体   繁体   English

在Createjs / Easeljs中使用触摸事件

[英]Using touch events with Createjs / Easeljs

I'm trying to use touch events with Createjs / Easeljs objects. 我正在尝试使用Createjs / Easeljs对象的触摸事件。 For example, I'm trying to attach a touchstart and touchmove event using addEventListener. 例如,我正在尝试使用addEventListener附加touchstart和touchmove事件。

Touchstart and mousedown seems to work: I'm using a browser and a touch device to test it and it seems to work in both cases. Touchstart和mousedown似乎有效:我正在使用浏览器和触摸设备来测试它,它似乎在两种情况下都有效。

However, mousemove and touchmove doesn't seem to work. 但是,mousemove和touchmove似乎不起作用。 I though it was because I removed the stopPropagation and preventDefault methods, but I saw that Lanny McNie wrote that there is no need to do it in CreateJS 1 . 我虽然是因为我删除了stopPropagation和preventDefault方法,但我看到Lanny McNie写道,在CreateJS 1中没有必要这样做。

I can't figure out why it doesn't work. 我无法弄清楚为什么它不起作用。

This is my code: http://pastebin.com/pqxWLNKG 这是我的代码: http//pastebin.com/pqxWLNKG

Regards. 问候。

You can use the Touch class included with EaselJS to enable multi-touch - which translate into normal EaselJS mousedown/mousemove events. 您可以使用EaselJS附带的Touch类来启用多点触控 - 这可以转换为正常的EaselJS mousedown / mousemove事件。 Check out the DragAndDrop demo: http://www.createjs.com/demos/easeljs/draganddrop 查看DragAndDrop演示: http ://www.createjs.com/demos/easeljs/draganddrop

createjs.Touch.enable(stage);

Cheers. 干杯。

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

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