canvas手指滑动画图的问题
< canvas disable-scroll = "true" bindtouchstart = "start" bindtouchmove = "move" bindtouchend = "end" class = "draw" canvas-id = "draw" /> |
start: function (event) { ctx.beginPath(); ctx.moveTo(event.changedTouches[0].x, event.changedTouches[0].y); },
ctx.lineTo(event.changedTouches[0].x, event.changedTouches[0].y); ctx.stroke(); ctx.draw(true); } |
为什么用手滑动的时候只能画开始的一点,之后的线就不显示了?而在move中做个限定,外部给个计数器,就可以,但是只能画虚线了?
......
ctx.beginPath(); ctx.moveTo(event.changedTouches[0].x, event.changedTouches[0].y); }, move: function (event) { ctx.lineTo(event.changedTouches[0].x, event.changedTouches[0].y);
if (ii > 1) { ii = 0; ctx.draw(true); } else { ii++; } } |