在TouchMove事件中,使用Graphics组件lineTo方法做一个绘画,在桌面浏览器下会出现下面情况
在模拟器和手机浏览器中则没有出现过
代码如下:
_onGraphicsTouchStart(sender, event) {
let location = event.getLocation();
this._drawGraphics(location);
},
_onGraphicsTouchMove(sender, event) {
let location = event.getLocation();
this._drawGraphics(location);
},
_onGraphicsTouchEnd(sender, event) {
this._startPoint = null;
},
_drawGraphics(point) {
if (!this._startPoint) {
this._startPoint = point;
this._graphics.$Graphics.moveTo(point.x, point.y);
return;
}
this._graphics.$Graphics.lineTo(point.x, point.y);
this._graphics.$Graphics.stroke();
},
我用的CocosCreator版本是1.5.2和1.70的桌面Web上都存在这个问题,猜想是不是电脑上是用鼠标模拟的触摸事件造成的?