修复 removelayer 清除交互事件的bug

fix demo
This commit is contained in:
thinkinggis 2019-08-26 15:36:59 +08:00
parent 235079336b
commit 5e1ef68cef
3 changed files with 7 additions and 8 deletions

View File

@ -47,7 +47,7 @@
opacity: 0.9
}).render();
scene.TextLayer({
const layer2 = scene.PointLayer({
zIndex: 5
})
.source(data)
@ -73,7 +73,6 @@
const popup = new L7.Popup({anchor:'left'}).setText('hello world')
const marker = new L7.Marker({color:'blue'})
.setLnglat( [120.19382669582967, 30.258134])

View File

@ -54,7 +54,7 @@ window.scene = scene;
scene.on('loaded', () => {
$.get('https://gw.alipayobjects.com/os/rmsportal/epnZEheZeDgsiSjSPcCv.json', data => {
console.log(data);
const circleLayer = = scene.PointLayer({
const circleLayer = scene.PointLayer({
zIndex: 0,
})
.source(data,{
@ -70,8 +70,8 @@ scene.on('loaded', () => {
opacity: 1
})
.render();
scene.TextLayer({
scene.PointLayer({
zIndex: 5
})
.source(circleLayer.layerSource)
@ -91,7 +91,8 @@ scene.on('loaded', () => {
})
.render();
});
});
});
</script>
</body>

View File

@ -608,7 +608,7 @@ export default class Layer extends Base {
*/
destroy() {
this.removeAllListeners();
this.clearAllInteractions();
this.get('interacionController').clearAllInteractions();
this.clearMapEvent();
if (this._object3D.type === 'composer') {
this.remove(this._object3D);
@ -639,7 +639,6 @@ export default class Layer extends Base {
}
}
this.layerMesh.geometry = null;
this.layerMesh.material.dispose();
this.layerMesh.material = null;
if (this._pickingMesh) {
this._pickingMesh.children[0].geometry = null;