See fiddle here: http://jsfiddle.net/mYdm9/4/
On my PC, doing
ctx.lineWidth=20;
ctx.setLineDash([20,30]);
ctx.lineDashOffset=10;
ctx.beginPath();
ctx.moveTo(150,150);
ctx.lineTo(240,240);
ctx.lineTo(180,40);
ctx.stroke();
ctx.closePath()
Gives the first set of lines, with the desired dashes/offsets
Now with
ctx.setLineDash([0,0]);
ctx.lineDashOffset=0
in the next batch of commands:
ctx.beginPath();
//resets line dash... except on iOS Safari it seems...
ctx.setLineDash([0,0]);
ctx.lineDashOffset=0;
ctx.moveTo(0,300);
ctx.lineTo(0,250);
ctx.lineTo(100,400);
ctx.lineTo(200,300);
ctx.stroke();
ctx.closePath()
After the first set of lines seems to reset any dash properties. Get solid lines again
On an iPad2 running Safari... it seems completely ignored, the lines stay dashed. Why is this? Also, is there some other method to properly resetting line dashes...? (preferably working cross browser/OS)
Thanks
Use this notation, it will work in all browsers that supports setLineDash
ctx.setLineDash([]);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With