I’m trying to allow the user to draw a rectangle on the canvas (like a selection box). I’m getting some ridiculous results, but then I noticed that even just trying the code from my reference here, I get huge fuzzy lines and don’t know why.
it’s hosted at dylanstestserver.com/drawcss. the javascript is inline so you can check it out. I am using jQuery to simplify getting the mouse coordinates.
For some reason, your canvas is stretched. Because you have its css property
widthset to100%, it is stretching it from some sort of native size. It’s the difference between using the csswidthproperty and thewidthattribute on the<canvas>tag. You might want to try using a bit of javascript to make it fill the viewport (see jQuery .width()):