-
Creator 版本:
-
目标平台: web
-
详细报错信息,包含调用堆栈:
-
重现方式:手指在屏幕滑动,Graphics会根据移动的点绘制路径,但偶尔会出现绘制出扇形的问题。
-
出现概率:偶尔,但概率较大
-
额外线索:正常的情况:
出错的情况:
代码:
touchStart(event){
let nodePoint=this.node.convertToNodeSpaceAR(event.getLocation());
this.graphics.moveTo(nodePoint.x,nodePoint.y);
this._path=[];
this._move=false;
},
touchMove(event){
let nodePoint=this.node.convertToNodeSpaceAR(event.getLocation());
this.graphics.lineTo(nodePoint.x,nodePoint.y);
this.graphics.stroke();
},
代码很简单,就是touchstart的时候moveto,然后touchmove的时候lineTo,并且绘制出路线。
没有大佬指点一下吗?
绘制的时候 绘制距离小于1像素的时候会出这个问题
touchMove(event){
let nodePoint=this.node.convertToNodeSpaceAR(event.getLocation());
this.graphics.lineTo(nodePoint.x,nodePoint.y);
this.graphics.stroke();
this.graphics.moveTo(nodePoint.x,nodePoint.y); stroke之后moveTo到这个点
},
改成这样试一下
3赞
遇见同样的问题,按层主说的解决了,棒棒~!
不move点多了drawcall疯狂往上涨确实
手动感谢
好奇大牛是怎么知道这种写法的?

