From f7fd05cfba647af542ef6b25ceddc5737a278e78 Mon Sep 17 00:00:00 2001 From: Christopher Willis-Ford Date: Tue, 10 Jan 2017 15:22:33 -0800 Subject: [PATCH] Use skin-relative coordinates for Pen actions --- src/PenSkin.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/PenSkin.js b/src/PenSkin.js index 421dc0d..2e37781 100644 --- a/src/PenSkin.js +++ b/src/PenSkin.js @@ -102,9 +102,9 @@ class PenSkin extends Skin { drawLine (location0, location1, penAttributes) { const ctx = this._canvas.getContext('2d'); this._setAttributes(ctx, penAttributes); - ctx.moveTo(location0[0], location0[1]); + ctx.moveTo(location0[0] + this._rotationCenter[0], location0[1] + this._rotationCenter[1]); ctx.beginPath(); - ctx.lineTo(location1[0], location1[1]); + ctx.lineTo(location1[0] + this._rotationCenter[0], location1[1] + this._rotationCenter[1]); ctx.stroke(); this._canvasDirty = true; } @@ -116,7 +116,7 @@ class PenSkin extends Skin { */ drawStamp (location, stampElement) { const ctx = this._canvas.getContext('2d'); - ctx.drawImage(stampElement, location[0], location[1]); + ctx.drawImage(stampElement, location[0] + this._rotationCenter[0], location[1] + this._rotationCenter[1]); this._canvasDirty = true; }