ZFZF
ZFZF
  • 发布:2022-03-08 11:44
  • 更新:2022-03-08 11:44
  • 阅读:1029

canvas的draw(false)把之前绘制的内容都给清空

分类:uni-app

实现画布中线条功能
touchstart的时候:
this.dom.beginPath();
this.dom.setStrokeStyle(StrokesItem.style.color);
this.dom.moveTo(x1, y1);
this.dom.lineTo(x2, y2);
this.dom.stroke();
this.dom.draw(true);

touchmove:
...同touchstart中步骤
this.dom.draw(false);

touchend:
...同touchstart中步骤
this.dom.draw(true);

这样可以实现绘制线条,但是绘制第二条线条的时候前一个就被清空了

2022-03-08 11:44 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复