Use skin-relative coordinates for Pen actions

This commit is contained in:
Christopher Willis-Ford 2017-01-10 15:22:33 -08:00
parent 78c0d09c72
commit f7fd05cfba

View file

@ -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;
}