pointy top squares
This commit is contained in:
@@ -55,10 +55,10 @@ export default class CartographerXY extends Cartographer {
|
||||
|
||||
const minWidth = (a) => this.minWidth() * a;
|
||||
|
||||
const maxWidth = (a) => this.maxWidth() * a;
|
||||
const maxWidth = (a, b) => (this.maxWidth() * a) + ((b % 2) * (this.maxWidth() / 2));
|
||||
|
||||
let pixelX = this.pointyTop ? maxWidth(square.getX()) : minWidth(square.getX());
|
||||
let pixelY = this.pointyTop ? maxWidth(square.getY()) : minWidth(square.getY());
|
||||
let pixelX = this.pointyTop ? maxWidth(square.getX(), square.getY()) : minWidth(square.getX());
|
||||
let pixelY = this.pointyTop ? (this.maxWidth() / 2) * square.getY() : minWidth(square.getY());
|
||||
|
||||
pixelX += this.originX;
|
||||
pixelY += this.originY;
|
||||
@@ -69,7 +69,7 @@ export default class CartographerXY extends Cartographer {
|
||||
pixelToTile(point) {
|
||||
let scale = this.scale;
|
||||
|
||||
const radiusLong = a => a / this.maxWidth();
|
||||
const radiusLong = a => (a / (this.maxWidth() / 2));
|
||||
const radiusShort = a => a / this.minWidth();
|
||||
|
||||
let pixelX = point.getX() - this.originX;
|
||||
@@ -96,7 +96,7 @@ export default class CartographerXY extends Cartographer {
|
||||
for (let row = 0; row <= height; row++) {
|
||||
tiles[row] = [];
|
||||
let y = upperLeftTile.getY() + row;
|
||||
let xOffset = upperLeftTile.getX();
|
||||
let xOffset = upperLeftTile.getX() - (row % 2);
|
||||
|
||||
for (let x = xOffset; x <= xOffset + width; x++) {
|
||||
tiles[row].push(new Square(x, y));
|
||||
|
||||
Reference in New Issue
Block a user