UNPKG

@tomiaa/canvas-graffiti

Version:
16 lines (15 loc) 616 B
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.moveTo(this.beginPoint.x, this.beginPoint.y), this.bufferCtx.lineTo(t, i), this.endPoint = { x: t, y: i }, this.bufferCtx.stroke(); }, pointerup() { this.endPoint && (this.ctx.beginPath(), this.ctx.moveTo(this.beginPoint.x, this.beginPoint.y), this.ctx.lineTo(this.endPoint.x, this.endPoint.y), this.ctx.stroke()); } }; export { e as Line };