HTML5 canvas stroke() thick and fuzzy

后端 未结 7 1758
野性不改
野性不改 2020-12-09 08:04

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 co

7条回答
  •  半阙折子戏
    2020-12-09 08:34

    The css sizing issue mentioned in these comments is correct, but another more subtle thing that can cause blurred lines is forgetting to call make a call to context.beginPath() before drawing a line. Without calling this, you will still get a line, but it won't be smoothed which makes the line looks like a series of steps.

提交回复
热议问题