more straightforward approach to providing location data for wrapped maps

This commit is contained in:
Gavin McDonald
2019-01-12 22:50:36 -05:00
parent a5bcda516a
commit 064bf10e98
7 changed files with 132 additions and 101 deletions

View File

@@ -148,26 +148,28 @@ export class Tessellate {
}
tap (event) {
let point = new Point(event.offsetX, event.offsetY);
const point = new Point(event.offsetX, event.offsetY);
const tile = this.cartographer.pixelToTile(point);
const mapTile = this.cartographer.teleport(tile);
let tile = this.cartographer.pixelToTile(point);
let tap = {
this.settings.tap({
event,
mapTile,
point,
tile
};
this.settings.tap(tap);
tile,
});
}
doubletap (event) {
console.log('DOUBLETAP', event);
let point = new Point(event.offsetX, event.offsetY);
let tile = this.cartographer.pixelToTile(point);
const point = new Point(event.offsetX, event.offsetY);
const tile = this.cartographer.pixelToTile(point);
const mapTile = this.cartographer.teleport(tile);
let tap = {
event,
map,
mapTile,
point,
tile
};
@@ -176,29 +178,44 @@ export class Tessellate {
}
pressStart (event) {
let point = new Point(event.offsetX, event.offsetY);
let tile = this.cartographer.pixelToTile(point);
const point = new Point(event.offsetX, event.offsetY);
const tile = this.cartographer.pixelToTile(point);
const mapTile = this.cartographer.teleport(tile);
let tap = {
event,
mapTile,
point,
tile
};
this.settings.pressStart(tap);
console.log(tap);
}
pressStart (event) {
const point = new Point(event.offsetX, event.offsetY);
const tile = this.cartographer.pixelToTile(point);
const mapTile = this.cartographer.teleport(tile);
this.settings.pressStart({
event,
mapTile,
point,
tile,
});
}
press (event) {
let point = new Point(event.offsetX, event.offsetY);
let tile = this.cartographer.pixelToTile(point);
const point = new Point(event.offsetX, event.offsetY);
const tile = this.cartographer.pixelToTile(point);
const mapTile = this.cartographer.teleport(tile);
let tap = {
this.settings.press({
event,
mapTile,
point,
tile
};
this.settings.press(tap);
tile,
});
}
move (event) {
@@ -213,8 +230,8 @@ export class Tessellate {
return this.cartographer.pixelToTile(x, y);
}
tileToPixel (x, y, z) {
return this.cartographer.tileToPixel(x, y, z);
tileToPixel (tilePoint) {
return this.cartographer.tileToPixel(tilePoint);
}
getTilePoints ({upperLeftX, upperLeftY, lowerRightX, lowerRightY}) {