renaming things

This commit is contained in:
Gavin McDonald
2019-01-13 15:15:39 -05:00
parent 064bf10e98
commit 1ba10b1f87
6 changed files with 22 additions and 22 deletions

View File

@@ -7,8 +7,8 @@ import Point from './point.js';
import Square from './square.js';
const tilePointToSquare = ({tilePoint, mapPoint, pixelPoint}) => ({
tilePoint: tilePoint instanceof Square ? tilePoint : new Square(tilePoint),
mapPoint: mapPoint instanceof Square ? mapPoint : new Square(mapPoint),
tile: tilePoint instanceof Square ? tilePoint : new Square(tilePoint),
mapTile: mapPoint instanceof Square ? mapPoint : new Square(mapPoint),
pixelPoint,
});

View File

@@ -7,8 +7,8 @@ import Hex from './hex.js';
import Point from './point.js';
const tilePointToHex = ({tilePoint, mapPoint, pixelPoint}) => ({
tilePoint: tilePoint instanceof Hex ? tilePoint : new Hex(tilePoint),
mapPoint: mapPoint instanceof Hex ? mapPoint : new Hex(mapPoint),
tile: tilePoint instanceof Hex ? tilePoint : new Hex(tilePoint),
mapTile: mapPoint instanceof Hex ? mapPoint : new Hex(mapPoint),
pixelPoint,
});

View File

@@ -7,8 +7,8 @@ import Square from './square.js';
import Point from './point.js';
const tilePointToSquare = ({tilePoint, mapPoint, pixelPoint}) => ({
tilePoint: tilePoint instanceof Square ? tilePoint : new Square(tilePoint),
mapPoint: mapPoint instanceof Square ? mapPoint : new Square(mapPoint),
tile: tilePoint instanceof Square ? tilePoint : new Square(tilePoint),
mapTile: mapPoint instanceof Square ? mapPoint : new Square(mapPoint),
pixelPoint,
});

View File

@@ -7,8 +7,8 @@ import Hex from './hex.js';
import Point from './point.js';
const tilePointToHex = ({tilePoint, mapPoint, pixelPoint}) => ({
tilePoint: tilePoint instanceof Hex ? tilePoint : new Hex(tilePoint),
mapPoint: mapPoint instanceof Hex ? mapPoint : new Hex(mapPoint),
tile: tilePoint instanceof Hex ? tilePoint : new Hex(tilePoint),
mapTile: mapPoint instanceof Hex ? mapPoint : new Hex(mapPoint),
pixelPoint,
});

View File

@@ -225,17 +225,17 @@ class Demo {
return tile;
}
drawTile(pointGroup, context, scale) {
const pixelX = pointGroup.pixelPoint.getX();
const pixelY = pointGroup.pixelPoint.getY();
drawTile(locationSet, context, scale) {
const pixelX = locationSet.pixelPoint.getX();
const pixelY = locationSet.pixelPoint.getY();
this.counts[0] += 1;
const key = keyTemplate(pointGroup.mapPoint);
const key = keyTemplate(locationSet.mapTile);
this.map[key] = this.map[key] || this.createTile({
x: pointGroup.mapPoint.x,
y: pointGroup.mapPoint.y,
x: locationSet.mapTile.x,
y: locationSet.mapTile.y,
drawStyle: this.settings.style,
tileStyle: this.settings.tile,
orientation: this.settings.orientation,
@@ -270,7 +270,7 @@ class Demo {
}
}
draw({context, height, width, scale, pointGroups, now, lastNow}) {
draw({context, height, width, scale, locationSets, now, lastNow}) {
this.counts = [
0, // tiles
0, // pips
@@ -283,9 +283,9 @@ class Demo {
blue: 128,
});
pointGroups
.filter(pointGroup => pointGroup.mapPoint)
.forEach(pointGroup => this.drawTile(pointGroup, context, scale));
locationSets
.filter(locationSet => locationSet.mapTile)
.forEach(locationSet => this.drawTile(locationSet, context, scale));
this.ripples.forEach(({timestamp, cell}) => {
const pressFactor = Math.min((now - timestamp) / PRESS_RIPPLE, 1);

View File

@@ -87,7 +87,7 @@ export class Tessellate {
'zoom',
'pixelToTile',
'tileToPixel',
'getTilePoints',
'getLocationSets',
'draw',
'resize',
'remap',
@@ -234,7 +234,7 @@ export class Tessellate {
return this.cartographer.tileToPixel(tilePoint);
}
getTilePoints ({upperLeftX, upperLeftY, lowerRightX, lowerRightY}) {
getLocationSets ({upperLeftX, upperLeftY, lowerRightX, lowerRightY}) {
const upperLeft = new Point(upperLeftX, upperLeftY);
const upperRight = new Point(lowerRightX, 0);
const lowerLeft = new Point(0, lowerRightY);
@@ -255,7 +255,7 @@ export class Tessellate {
lowerRightY: height
};
const pointGroups = this.getTilePoints(corners);
const locationSets = this.getLocationSets(corners);
this.settings.draw({
context,
@@ -266,7 +266,7 @@ export class Tessellate {
lastNow: context.lastUTC,
now: context.utc,
pointGroups,
locationSets,
});
}