kopia lustrzana https://github.com/robhawkes/vizicities
Fix interaction events
rodzic
c04ee9c501
commit
4edfff3946
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -134,16 +134,21 @@ class PointLayer extends Layer {
|
|||
|
||||
// Get unique ID for picking interaction
|
||||
_setPickingId() {
|
||||
this._pickingId = this.getPickingId();
|
||||
this._pickingId = this._options.pickingId = this.getPickingId();
|
||||
}
|
||||
|
||||
// Set up and re-emit interaction events
|
||||
_addPickingEvents() {
|
||||
// TODO: Find a way to properly remove this listener on destroy
|
||||
this._world.on('pick-' + this._pickingId, (point2d, point3d, intersects) => {
|
||||
this._world.on('pick-click-' + this._pickingId, (point2d, point3d, intersects) => {
|
||||
// Re-emit click event from the layer
|
||||
this.emit('click', this, point2d, point3d, intersects);
|
||||
});
|
||||
|
||||
this._world.on('pick-hover-' + this._pickingId, (point2d, point3d, intersects) => {
|
||||
// Re-emit click event from the layer
|
||||
this.emit('hover', this, point2d, point3d, intersects);
|
||||
});
|
||||
}
|
||||
|
||||
static SetBufferAttributes(coordinates, options) {
|
||||
|
|
|
@ -134,16 +134,21 @@ class PolygonLayer extends Layer {
|
|||
|
||||
// Get unique ID for picking interaction
|
||||
_setPickingId() {
|
||||
this._pickingId = this.getPickingId();
|
||||
this._pickingId = this._options.pickingId = this.getPickingId();
|
||||
}
|
||||
|
||||
// Set up and re-emit interaction events
|
||||
_addPickingEvents() {
|
||||
// TODO: Find a way to properly remove this listener on destroy
|
||||
this._world.on('pick-' + this._pickingId, (point2d, point3d, intersects) => {
|
||||
this._world.on('pick-click-' + this._pickingId, (point2d, point3d, intersects) => {
|
||||
// Re-emit click event from the layer
|
||||
this.emit('click', this, point2d, point3d, intersects);
|
||||
});
|
||||
|
||||
this._world.on('pick-hover-' + this._pickingId, (point2d, point3d, intersects) => {
|
||||
// Re-emit click event from the layer
|
||||
this.emit('hover', this, point2d, point3d, intersects);
|
||||
});
|
||||
}
|
||||
|
||||
// Create and store reference to THREE.BufferAttribute data for this layer
|
||||
|
|
|
@ -130,16 +130,21 @@ class PolylineLayer extends Layer {
|
|||
|
||||
// Get unique ID for picking interaction
|
||||
_setPickingId() {
|
||||
this._pickingId = this.getPickingId();
|
||||
this._pickingId = this._options.pickingId = this.getPickingId();
|
||||
}
|
||||
|
||||
// Set up and re-emit interaction events
|
||||
_addPickingEvents() {
|
||||
// TODO: Find a way to properly remove this listener on destroy
|
||||
this._world.on('pick-' + this._pickingId, (point2d, point3d, intersects) => {
|
||||
this._world.on('pick-click-' + this._pickingId, (point2d, point3d, intersects) => {
|
||||
// Re-emit click event from the layer
|
||||
this.emit('click', this, point2d, point3d, intersects);
|
||||
});
|
||||
|
||||
this._world.on('pick-hover-' + this._pickingId, (point2d, point3d, intersects) => {
|
||||
// Re-emit click event from the layer
|
||||
this.emit('hover', this, point2d, point3d, intersects);
|
||||
});
|
||||
}
|
||||
|
||||
static SetBufferAttributes(coordinates, options) {
|
||||
|
|
Ładowanie…
Reference in New Issue