I guess I didn't test before that last commit
This commit is contained in:
@@ -50,7 +50,7 @@ export default class CartographerFlatXY extends Cartographer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tileToPixel(square) {
|
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 x = square.getX() * this.minWidth();
|
||||||
const y = square.getY() * this.minWidth();
|
const y = square.getY() * this.minWidth();
|
||||||
@@ -59,7 +59,7 @@ export default class CartographerFlatXY extends Cartographer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pixelToTile(point) {
|
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 pixelX = point.getX() - this.originX;
|
||||||
const pixelY = this.originY - point.getY();
|
const pixelY = this.originY - point.getY();
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ export default class CartographerFlatXYZ extends Cartographer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tileToPixel(hex) {
|
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 pixelX = this.scale * 3/2 * hex.getQ();
|
||||||
const pixelY = this.scale * sqrt3 * (hex.getR() + (hex.getQ() / 2));
|
const pixelY = this.scale * sqrt3 * (hex.getR() + (hex.getQ() / 2));
|
||||||
@@ -59,7 +59,7 @@ export default class CartographerFlatXYZ extends Cartographer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pixelToTile(point) {
|
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 pixelX = point.getX() - this.originX;
|
||||||
const pixelY = point.getY() - this.originY;
|
const pixelY = point.getY() - this.originY;
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ export default class CartographerPointyXY extends Cartographer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tileToPixel(square) {
|
tileToPixel(square) {
|
||||||
square = typeof square === 'Square' ? square : new Square(...arguments);
|
square = square instanceof Square ? square : new Square(...arguments);
|
||||||
|
|
||||||
const x = square.getX();
|
const x = square.getX();
|
||||||
const y = square.getY();
|
const y = square.getY();
|
||||||
@@ -63,7 +63,7 @@ export default class CartographerPointyXY extends Cartographer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pixelToTile(point) {
|
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 pixelX = point.getX() - this.originX;
|
||||||
const pixelY = this.originY - point.getY();
|
const pixelY = this.originY - point.getY();
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ export default class CartographerPointyXYZ extends Cartographer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tileToPixel(hex) {
|
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 pixelX = this.scale * sqrt3 * (hex.getQ() + (hex.getR() / 2));
|
||||||
const pixelY = this.scale * 3/2 * hex.getR();
|
const pixelY = this.scale * 3/2 * hex.getR();
|
||||||
@@ -59,7 +59,7 @@ export default class CartographerPointyXYZ extends Cartographer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pixelToTile(point) {
|
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 pixelX = point.getX() - this.originX;
|
||||||
const pixelY = point.getY() - this.originY;
|
const pixelY = point.getY() - this.originY;
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ class Demo {
|
|||||||
utils.random(Tessellate.TILE_STYLES),
|
utils.random(Tessellate.TILE_STYLES),
|
||||||
utils.random(Tessellate.TILE_ORIENTATIONS),
|
utils.random(Tessellate.TILE_ORIENTATIONS),
|
||||||
));
|
));
|
||||||
console.log(this.map[this.map.length - 1]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
createTile(x, y, drawStyle, tileStyle, orientation) {
|
createTile(x, y, drawStyle, tileStyle, orientation) {
|
||||||
|
|||||||
@@ -95,9 +95,6 @@ export default class Tessellate {
|
|||||||
zoom: this.zoom
|
zoom: this.zoom
|
||||||
});
|
});
|
||||||
|
|
||||||
this.map = [];
|
|
||||||
this.seedTiles();
|
|
||||||
|
|
||||||
const cartographer = selectCartographer(this.settings.board, this.settings.orientation);
|
const cartographer = selectCartographer(this.settings.board, this.settings.orientation);
|
||||||
this.cartographer = new cartographer({
|
this.cartographer = new cartographer({
|
||||||
height: this.settings.height,
|
height: this.settings.height,
|
||||||
|
|||||||
Reference in New Issue
Block a user