From e4b9b87f44e4344ae690deddd336f533ed42a451 Mon Sep 17 00:00:00 2001 From: Gavin McDonald Date: Tue, 17 Jul 2018 21:04:53 -0400 Subject: [PATCH] I guess I didn't test before that last commit --- src/cartographerFlatXY.js | 4 ++-- src/cartographerFlatXYZ.js | 4 ++-- src/cartographerPointyXY.js | 4 ++-- src/cartographerPointyXYZ.js | 4 ++-- src/main.js | 1 - src/tessellate.js | 3 --- 6 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/cartographerFlatXY.js b/src/cartographerFlatXY.js index 59cbdc7..d5b9714 100644 --- a/src/cartographerFlatXY.js +++ b/src/cartographerFlatXY.js @@ -50,7 +50,7 @@ export default class CartographerFlatXY extends Cartographer { } tileToPixel(square) { - square = typeof square === 'Square' ? square : new Square(...arguments); + square = square instanceof Square ? square : new Square(...arguments); const x = square.getX() * this.minWidth(); const y = square.getY() * this.minWidth(); @@ -59,7 +59,7 @@ export default class CartographerFlatXY extends Cartographer { } pixelToTile(point) { - point = typeof point === 'Point' ? point : new Point(x, y); + point = point instanceof Point ? point : new Point(...arguments); const pixelX = point.getX() - this.originX; const pixelY = this.originY - point.getY(); diff --git a/src/cartographerFlatXYZ.js b/src/cartographerFlatXYZ.js index c776cc2..366a5c5 100644 --- a/src/cartographerFlatXYZ.js +++ b/src/cartographerFlatXYZ.js @@ -50,7 +50,7 @@ export default class CartographerFlatXYZ extends Cartographer { } tileToPixel(hex) { - hex = typeof hex === 'Hex' ? hex : new Hex(...arguments); + hex = hex instanceof Hex ? hex : new Hex(...arguments); const pixelX = this.scale * 3/2 * hex.getQ(); const pixelY = this.scale * sqrt3 * (hex.getR() + (hex.getQ() / 2)); @@ -59,7 +59,7 @@ export default class CartographerFlatXYZ extends Cartographer { } pixelToTile(point) { - point = typeof point === 'Point' ? point : new Point(x, y); + point = point instanceof Point ? point : new Point(...arguments); const pixelX = point.getX() - this.originX; const pixelY = point.getY() - this.originY; diff --git a/src/cartographerPointyXY.js b/src/cartographerPointyXY.js index bbffed0..2c819eb 100644 --- a/src/cartographerPointyXY.js +++ b/src/cartographerPointyXY.js @@ -50,7 +50,7 @@ export default class CartographerPointyXY extends Cartographer { } tileToPixel(square) { - square = typeof square === 'Square' ? square : new Square(...arguments); + square = square instanceof Square ? square : new Square(...arguments); const x = square.getX(); const y = square.getY(); @@ -63,7 +63,7 @@ export default class CartographerPointyXY extends Cartographer { } pixelToTile(point) { - point = typeof point === 'Point' ? point : new Point(x, y); + point = point instanceof Point ? point : new Point(...arguments); const pixelX = point.getX() - this.originX; const pixelY = this.originY - point.getY(); diff --git a/src/cartographerPointyXYZ.js b/src/cartographerPointyXYZ.js index 437e024..68c7966 100644 --- a/src/cartographerPointyXYZ.js +++ b/src/cartographerPointyXYZ.js @@ -50,7 +50,7 @@ export default class CartographerPointyXYZ extends Cartographer { } tileToPixel(hex) { - hex = typeof hex === 'Hex' ? hex : new Hex(...arguments); + hex = hex instanceof Hex ? hex : new Hex(...arguments); const pixelX = this.scale * sqrt3 * (hex.getQ() + (hex.getR() / 2)); const pixelY = this.scale * 3/2 * hex.getR(); @@ -59,7 +59,7 @@ export default class CartographerPointyXYZ extends Cartographer { } pixelToTile(point) { - point = typeof point === 'Point' ? point : new Point(x, y); + point = point instanceof Point ? point : new Point(...arguments); const pixelX = point.getX() - this.originX; const pixelY = point.getY() - this.originY; diff --git a/src/main.js b/src/main.js index 2f11d18..26ffc8c 100644 --- a/src/main.js +++ b/src/main.js @@ -52,7 +52,6 @@ class Demo { utils.random(Tessellate.TILE_STYLES), utils.random(Tessellate.TILE_ORIENTATIONS), )); - console.log(this.map[this.map.length - 1]); } createTile(x, y, drawStyle, tileStyle, orientation) { diff --git a/src/tessellate.js b/src/tessellate.js index a1620c2..a4b6c77 100644 --- a/src/tessellate.js +++ b/src/tessellate.js @@ -95,9 +95,6 @@ export default class Tessellate { zoom: this.zoom }); - this.map = []; - this.seedTiles(); - const cartographer = selectCartographer(this.settings.board, this.settings.orientation); this.cartographer = new cartographer({ height: this.settings.height,