From df8ce96e4c3b23937cd5c445d8a15ebfb45bae2d Mon Sep 17 00:00:00 2001 From: Robin Hawkes Date: Fri, 21 Oct 2016 14:30:52 +0100 Subject: [PATCH] Picking layers should now hide with layer --- src/layer/GeoJSONWorkerLayer.js | 4 ++-- src/layer/Layer.js | 8 ++++++++ src/layer/tile/TileLayer.js | 10 ++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/layer/GeoJSONWorkerLayer.js b/src/layer/GeoJSONWorkerLayer.js index 05586f6..23b7b5c 100644 --- a/src/layer/GeoJSONWorkerLayer.js +++ b/src/layer/GeoJSONWorkerLayer.js @@ -1093,11 +1093,11 @@ class GeoJSONWorkerLayer extends Layer { // Set up and re-emit interaction events _addPicking(pickingId, properties) { this._world.on('pick-click-' + pickingId, (pickingId, point2d, point3d, intersects) => { - this._world.emit('click', this, properties); + this._world.emit('click', this, properties, point2d, point3d); }); this._world.on('pick-hover-' + pickingId, (pickingId, point2d, point3d, intersects) => { - this._world.emit('hover', this, properties); + this._world.emit('hover', this, properties, point2d, point3d); }); } diff --git a/src/layer/Layer.js b/src/layer/Layer.js index d2a4069..e8531f7 100644 --- a/src/layer/Layer.js +++ b/src/layer/Layer.js @@ -126,11 +126,19 @@ class Layer extends EventEmitter { // TODO: Also hide any attached DOM layers hide() { this._object3D.visible = false; + + if (this._pickingMesh) { + this._pickingMesh.visible = false; + } } // TODO: Also show any attached DOM layers show() { this._object3D.visible = true; + + if (this._pickingMesh) { + this._pickingMesh.visible = true; + } } // Destroys the layer and removes it from the scene and memory diff --git a/src/layer/tile/TileLayer.js b/src/layer/tile/TileLayer.js index 910b652..0596925 100644 --- a/src/layer/tile/TileLayer.js +++ b/src/layer/tile/TileLayer.js @@ -349,12 +349,22 @@ class TileLayer extends Layer { show() { this._stop = false; + + if (this._tilesPicking) { + this._tilesPicking.visible = true; + } + this._calculateLOD(); super.show(); } hide() { this._stop = true; + + if (this._tilesPicking) { + this._tilesPicking.visible = false; + } + super.hide(); }