renaming things
This commit is contained in:
@@ -7,8 +7,8 @@ import Point from './point.js';
|
|||||||
import Square from './square.js';
|
import Square from './square.js';
|
||||||
|
|
||||||
const tilePointToSquare = ({tilePoint, mapPoint, pixelPoint}) => ({
|
const tilePointToSquare = ({tilePoint, mapPoint, pixelPoint}) => ({
|
||||||
tilePoint: tilePoint instanceof Square ? tilePoint : new Square(tilePoint),
|
tile: tilePoint instanceof Square ? tilePoint : new Square(tilePoint),
|
||||||
mapPoint: mapPoint instanceof Square ? mapPoint : new Square(mapPoint),
|
mapTile: mapPoint instanceof Square ? mapPoint : new Square(mapPoint),
|
||||||
pixelPoint,
|
pixelPoint,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import Hex from './hex.js';
|
|||||||
import Point from './point.js';
|
import Point from './point.js';
|
||||||
|
|
||||||
const tilePointToHex = ({tilePoint, mapPoint, pixelPoint}) => ({
|
const tilePointToHex = ({tilePoint, mapPoint, pixelPoint}) => ({
|
||||||
tilePoint: tilePoint instanceof Hex ? tilePoint : new Hex(tilePoint),
|
tile: tilePoint instanceof Hex ? tilePoint : new Hex(tilePoint),
|
||||||
mapPoint: mapPoint instanceof Hex ? mapPoint : new Hex(mapPoint),
|
mapTile: mapPoint instanceof Hex ? mapPoint : new Hex(mapPoint),
|
||||||
pixelPoint,
|
pixelPoint,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import Square from './square.js';
|
|||||||
import Point from './point.js';
|
import Point from './point.js';
|
||||||
|
|
||||||
const tilePointToSquare = ({tilePoint, mapPoint, pixelPoint}) => ({
|
const tilePointToSquare = ({tilePoint, mapPoint, pixelPoint}) => ({
|
||||||
tilePoint: tilePoint instanceof Square ? tilePoint : new Square(tilePoint),
|
tile: tilePoint instanceof Square ? tilePoint : new Square(tilePoint),
|
||||||
mapPoint: mapPoint instanceof Square ? mapPoint : new Square(mapPoint),
|
mapTile: mapPoint instanceof Square ? mapPoint : new Square(mapPoint),
|
||||||
pixelPoint,
|
pixelPoint,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import Hex from './hex.js';
|
|||||||
import Point from './point.js';
|
import Point from './point.js';
|
||||||
|
|
||||||
const tilePointToHex = ({tilePoint, mapPoint, pixelPoint}) => ({
|
const tilePointToHex = ({tilePoint, mapPoint, pixelPoint}) => ({
|
||||||
tilePoint: tilePoint instanceof Hex ? tilePoint : new Hex(tilePoint),
|
tile: tilePoint instanceof Hex ? tilePoint : new Hex(tilePoint),
|
||||||
mapPoint: mapPoint instanceof Hex ? mapPoint : new Hex(mapPoint),
|
mapTile: mapPoint instanceof Hex ? mapPoint : new Hex(mapPoint),
|
||||||
pixelPoint,
|
pixelPoint,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
20
src/main.js
20
src/main.js
@@ -225,17 +225,17 @@ class Demo {
|
|||||||
return tile;
|
return tile;
|
||||||
}
|
}
|
||||||
|
|
||||||
drawTile(pointGroup, context, scale) {
|
drawTile(locationSet, context, scale) {
|
||||||
const pixelX = pointGroup.pixelPoint.getX();
|
const pixelX = locationSet.pixelPoint.getX();
|
||||||
const pixelY = pointGroup.pixelPoint.getY();
|
const pixelY = locationSet.pixelPoint.getY();
|
||||||
|
|
||||||
this.counts[0] += 1;
|
this.counts[0] += 1;
|
||||||
|
|
||||||
const key = keyTemplate(pointGroup.mapPoint);
|
const key = keyTemplate(locationSet.mapTile);
|
||||||
|
|
||||||
this.map[key] = this.map[key] || this.createTile({
|
this.map[key] = this.map[key] || this.createTile({
|
||||||
x: pointGroup.mapPoint.x,
|
x: locationSet.mapTile.x,
|
||||||
y: pointGroup.mapPoint.y,
|
y: locationSet.mapTile.y,
|
||||||
drawStyle: this.settings.style,
|
drawStyle: this.settings.style,
|
||||||
tileStyle: this.settings.tile,
|
tileStyle: this.settings.tile,
|
||||||
orientation: this.settings.orientation,
|
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 = [
|
this.counts = [
|
||||||
0, // tiles
|
0, // tiles
|
||||||
0, // pips
|
0, // pips
|
||||||
@@ -283,9 +283,9 @@ class Demo {
|
|||||||
blue: 128,
|
blue: 128,
|
||||||
});
|
});
|
||||||
|
|
||||||
pointGroups
|
locationSets
|
||||||
.filter(pointGroup => pointGroup.mapPoint)
|
.filter(locationSet => locationSet.mapTile)
|
||||||
.forEach(pointGroup => this.drawTile(pointGroup, context, scale));
|
.forEach(locationSet => this.drawTile(locationSet, context, scale));
|
||||||
|
|
||||||
this.ripples.forEach(({timestamp, cell}) => {
|
this.ripples.forEach(({timestamp, cell}) => {
|
||||||
const pressFactor = Math.min((now - timestamp) / PRESS_RIPPLE, 1);
|
const pressFactor = Math.min((now - timestamp) / PRESS_RIPPLE, 1);
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ export class Tessellate {
|
|||||||
'zoom',
|
'zoom',
|
||||||
'pixelToTile',
|
'pixelToTile',
|
||||||
'tileToPixel',
|
'tileToPixel',
|
||||||
'getTilePoints',
|
'getLocationSets',
|
||||||
'draw',
|
'draw',
|
||||||
'resize',
|
'resize',
|
||||||
'remap',
|
'remap',
|
||||||
@@ -234,7 +234,7 @@ export class Tessellate {
|
|||||||
return this.cartographer.tileToPixel(tilePoint);
|
return this.cartographer.tileToPixel(tilePoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
getTilePoints ({upperLeftX, upperLeftY, lowerRightX, lowerRightY}) {
|
getLocationSets ({upperLeftX, upperLeftY, lowerRightX, lowerRightY}) {
|
||||||
const upperLeft = new Point(upperLeftX, upperLeftY);
|
const upperLeft = new Point(upperLeftX, upperLeftY);
|
||||||
const upperRight = new Point(lowerRightX, 0);
|
const upperRight = new Point(lowerRightX, 0);
|
||||||
const lowerLeft = new Point(0, lowerRightY);
|
const lowerLeft = new Point(0, lowerRightY);
|
||||||
@@ -255,7 +255,7 @@ export class Tessellate {
|
|||||||
lowerRightY: height
|
lowerRightY: height
|
||||||
};
|
};
|
||||||
|
|
||||||
const pointGroups = this.getTilePoints(corners);
|
const locationSets = this.getLocationSets(corners);
|
||||||
|
|
||||||
this.settings.draw({
|
this.settings.draw({
|
||||||
context,
|
context,
|
||||||
@@ -266,7 +266,7 @@ export class Tessellate {
|
|||||||
lastNow: context.lastUTC,
|
lastNow: context.lastUTC,
|
||||||
now: context.utc,
|
now: context.utc,
|
||||||
|
|
||||||
pointGroups,
|
locationSets,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user