为什么onTouchMoved在Chrome模拟器中无法触发

var listener = cc.EventListener.create({
            event: cc.EventListener.TOUCH_ONE_BY_ONE,
            swallowTouches: true,      // 设置是否吞没事件,在 onTouchBegan 方法返回 true 时吞没             
            onTouchBegan: function (touch, event) { 
                var pos = touch.getLocation();
                cc.log(pos);
                return false;
            },
            onTouchMoved: function (touch, event){
                var pos = touch.getLocation();
                cc.log(pos);
            }
        });
        cc.eventManager.addListener(listener, this);

```


如图所示, 在Chrome模拟器下在点击后(按下后抬起), 触发onTouchBegan, 但是我需要的onTouchMoved一直不触发, 请问是什么问题呢?
cocos2d-js版本3.1

自己解决了, 发现在iphone的safari上是好的, 所以估计是不是引擎在判断是否支持touch事件上的逻辑有问题
在CCBoot.js 第1637行找到相关逻辑为

if (docEle'ontouchstart'] !== undefined || nav.msPointerEnabled)
        capabilities"touches"] = true;

```

其中的docEle即为document.documentElement, 在safari上document.documentElement.ontouchstart是好的, 但是在Chrome上
只有window.ontouchstart, 所以只要自己在cocos引擎之前加上document.documentElement.ontouchstart=true就好了

我也遇到了这个问题,后来发现是this.onTouchBegan的最后一行忘记加上return true;了

1赞