I'm tasked to do cropping in canvas and i'm finished with all the logic but one requirement is yet to be finished i.e to draw a dashed rectangle while selecting cropping area like:
strokeRect(x, y, width, height)
How can I draw a dashed rectangle?
This has been added to the canvas spec, not all browsers have implemented it yet, but here it is.
context.setLineDash([6]);
context.strokeRect(0, 0, 50, 50);
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