give my poor fan a break
This commit is contained in:
@@ -95,11 +95,11 @@ export class Tessellate {
|
||||
|
||||
this.checkSettings(settings);
|
||||
|
||||
this.sketch = new Sketch(Object.assign({
|
||||
this.sketch = new Sketch({
|
||||
element: this.settings.element,
|
||||
draw: this.draw,
|
||||
resize: this.resize,
|
||||
}, funky.pick(this.settings, ['drawDelay'])));
|
||||
});
|
||||
|
||||
this.onTap = new OnTap(Object.assign({
|
||||
element: this.settings.element,
|
||||
@@ -152,6 +152,8 @@ export class Tessellate {
|
||||
const tile = this.cartographer.pixelToTile(point);
|
||||
const mapTile = this.cartographer.teleport(tile);
|
||||
|
||||
this.interacted = true;
|
||||
|
||||
this.settings.tap({
|
||||
event,
|
||||
mapTile,
|
||||
@@ -166,6 +168,8 @@ export class Tessellate {
|
||||
const tile = this.cartographer.pixelToTile(point);
|
||||
const mapTile = this.cartographer.teleport(tile);
|
||||
|
||||
this.interacted = true;
|
||||
|
||||
let tap = {
|
||||
event,
|
||||
map,
|
||||
@@ -182,20 +186,7 @@ export class Tessellate {
|
||||
const tile = this.cartographer.pixelToTile(point);
|
||||
const mapTile = this.cartographer.teleport(tile);
|
||||
|
||||
let tap = {
|
||||
event,
|
||||
mapTile,
|
||||
point,
|
||||
tile
|
||||
};
|
||||
|
||||
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.interacted = true;
|
||||
|
||||
this.settings.pressStart({
|
||||
event,
|
||||
@@ -210,6 +201,8 @@ export class Tessellate {
|
||||
const tile = this.cartographer.pixelToTile(point);
|
||||
const mapTile = this.cartographer.teleport(tile);
|
||||
|
||||
this.interacted = true;
|
||||
|
||||
this.settings.press({
|
||||
event,
|
||||
mapTile,
|
||||
@@ -234,7 +227,25 @@ export class Tessellate {
|
||||
return this.cartographer.tileToPixel(tilePoint);
|
||||
}
|
||||
|
||||
getLocationSets ({upperLeftX, upperLeftY, lowerRightX, lowerRightY}) {
|
||||
newLocation (corners) {
|
||||
this.lastLocation = this.lastLocation || {};
|
||||
|
||||
const currentLocation = utils.extend({
|
||||
originX: this.cartographer.getOriginX(),
|
||||
originY: this.cartographer.getOriginY(),
|
||||
scaleOrig: this.cartographer.getScale(),
|
||||
}, corners);
|
||||
|
||||
const changed = funky.reduce(currentLocation, (same, val, key) => same || this.lastLocation[key] !== val, false);
|
||||
|
||||
this.lastLocation = currentLocation;
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
getLocationSets (corners) {
|
||||
const {upperLeftX, upperLeftY, lowerRightX, lowerRightY} = corners;
|
||||
|
||||
const upperLeft = new Point(upperLeftX, upperLeftY);
|
||||
const upperRight = new Point(lowerRightX, 0);
|
||||
const lowerLeft = new Point(0, lowerRightY);
|
||||
@@ -255,9 +266,13 @@ export class Tessellate {
|
||||
lowerRightY: height
|
||||
};
|
||||
|
||||
const locationSets = this.getLocationSets(corners);
|
||||
const interacted = this.interacted;
|
||||
this.interacted = false;
|
||||
|
||||
this.settings.draw({
|
||||
const moved = this.newLocation(corners);
|
||||
this.locationSets = moved ? this.getLocationSets(corners) : this.locationSets;
|
||||
|
||||
return this.settings.draw({
|
||||
context,
|
||||
|
||||
height, width,
|
||||
@@ -266,7 +281,9 @@ export class Tessellate {
|
||||
lastNow: context.lastUTC,
|
||||
now: context.utc,
|
||||
|
||||
locationSets,
|
||||
interacted,
|
||||
moved,
|
||||
locationSets: this.locationSets,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user