Is there already a canvas drawing directive for AngularJS out there?

后端 未结 4 1649
深忆病人
深忆病人 2020-12-07 09:58

Is there already a directive to draw/paint things on a canvas? So you can implement something like Paint or even something bigger like Photoshop etc., but a very basic examp

4条回答
  •  猫巷女王i
    2020-12-07 10:26

    Some time ago i built a configurable directive for that.

    https://github.com/pwambach/angular-canvas-painter

    The directive creates the canvas element and adds handlers for mousedown/mousemove/mouseup events (and corresponding touch events) to the element. Mousedown and following mousemove events draw bezier curves with the canvasContext.quadraticCurveTo() method for smoother strokes (instead of just painting circles for every point). For details on the drawing algorithm have a look at this article: http://codetheory.in/html5-canvas-drawing-lines-with-smooth-edges/

提交回复
热议问题