本文介绍了使用触摸事件与Createjs / Easeljs的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用触摸事件与Createjs / Easeljs对象。例如,我想使用addEventListener附加touchstart和touchmove事件。

I'm trying to use touch events with Createjs / Easeljs objects. For example, I'm trying to attach a touchstart and touchmove event using addEventListener.

Touchstart和mousedown似乎有效:我使用的是浏览器和触摸设备测试它,它似乎工作在这两种情况下。

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.

然而,mousemove和touchmove似乎不工作。我虽然是因为我删除了stopPropagation和preventDefault方法,但我看到Lanny McNie写道,没有必要做CreateJS 。

However, mousemove and touchmove doesn't seem to work. 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.

我不知道为什么它不工作。

I can't figure out why it doesn't work.

这是我的代码:

回答。

推荐答案

Touch类包括EaselJS以启用多点触摸 - 这转换为正常的EaselJS mousedown / mousemove事件。查看DragAndDrop演示: http://www.createjs.com/Demos/EaselJS/DragAndDrop.html

You can use the Touch class included with EaselJS to enable multi-touch - which translate into normal EaselJS mousedown/mousemove events. Check out the DragAndDrop demo: http://www.createjs.com/Demos/EaselJS/DragAndDrop.html

createjs.Touch.enable(stage);

干杯。

这篇关于使用触摸事件与Createjs / Easeljs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 18:41