report location of hex coordinate on tap
This commit is contained in:
@@ -20,8 +20,8 @@ export default class Tessellate {
|
||||
constructor(settings) {
|
||||
['tap', 'draw', 'drawMap', 'move', 'zoom'].map(method => {this[method] = this[method].bind(this)});
|
||||
|
||||
this.tapCB = settings.tap || utils.noop;
|
||||
this.drawCB = settings.draw || utils.noop;
|
||||
this.clickCB = settings.click || utils.noop;
|
||||
this.element = document.querySelector(settings.element);
|
||||
|
||||
this.sketch = new Sketch({
|
||||
@@ -48,7 +48,16 @@ export default class Tessellate {
|
||||
}
|
||||
|
||||
tap(event) {
|
||||
this.clickCB(event);
|
||||
let point = new Point(event.offsetX, event.offsetY);
|
||||
let hex = this.xyz.pixelToHex(point);
|
||||
|
||||
let tap = {
|
||||
event,
|
||||
point,
|
||||
hex
|
||||
};
|
||||
|
||||
this.tapCB(tap);
|
||||
}
|
||||
|
||||
move(event) {
|
||||
|
||||
Reference in New Issue
Block a user