@tomiaa/canvas-graffiti
Version:
28 lines (27 loc) • 713 B
JavaScript
const e = {
buffer: !0,
pointerdown({ offsetX: t, offsetY: i }) {
this.bufferCtx.moveTo(t, i);
},
pointermove({ offsetX: t, offsetY: i }) {
this.bufferCtx.clearRect(0, 0, this.el.width, this.el.height), this.bufferCtx.beginPath(), this.bufferCtx.arc(
this.beginPoint.x,
this.beginPoint.y,
Math.abs(t - this.beginPoint.x),
0,
2 * Math.PI
), this.endPoint = { x: t, y: i }, this.bufferCtx.stroke();
},
pointerup() {
this.endPoint && (this.ctx.beginPath(), this.ctx.arc(
this.beginPoint.x,
this.beginPoint.y,
Math.abs(this.endPoint.x - this.beginPoint.x),
0,
2 * Math.PI
), this.ctx.stroke());
}
};
export {
e as Arc
};