update setting origin for non-negative boards

This commit is contained in:
Gavin McDonald
2018-10-07 11:18:30 -04:00
parent 3d25f6c35b
commit 6cd346200c

View File

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