diff --git a/src/cartographer.js b/src/cartographer.js index 76bdfef..975f91b 100644 --- a/src/cartographer.js +++ b/src/cartographer.js @@ -54,16 +54,16 @@ export default class Cartographer { setOriginX (canvasWidth, centerX) { this.originX = centerX ? centerX - canvasWidth / 2 : this.negativeTiles ? parseInt(canvasWidth / 2) : - this.width ? ((this.width * this.tileWidth()) / -2) + (canvasWidth / 2) + (this.tileWidth() / 2) : + this.width ? ((this.width * this.horizontalDistance()) / -2) + (canvasWidth / 2) + (this.horizontalDistance() / 2) : this.tileWidth() / 2; } setOriginY (canvasHeight, centerY) { - const boardHeight = this.height * this.tileHeight(); + const boardHeight = this.height * this.verticalDistance(); this.originY = centerY ? centerY + canvasHeight / 2 : this.negativeTiles ? parseInt(canvasHeight / 2) : - this.height ? (boardHeight) - ((boardHeight - canvasHeight) / 2) - (this.tileHeight() / 2) : + this.height ? (boardHeight) - ((boardHeight - canvasHeight) / 2) - (this.verticalDistance() / 2) : canvasHeight - (this.tileHeight() / 2); }