mirror of https://gitee.com/antv-l7/antv-l7
fix: 修改 scene destroy、兼容 L7React scene 和 layer 同时销毁导致的问题
This commit is contained in:
parent
6250302f9e
commit
4e3cb3a1de
|
@ -405,7 +405,12 @@ export default class Scene extends EventEmitter implements ISceneService {
|
|||
this.emit('destroy');
|
||||
|
||||
this.layerService.destroy();
|
||||
// this.rendererService.destroy();
|
||||
setTimeout(() => {
|
||||
// Tip: 把这一部分销毁放到写下一个事件循环中执行,兼容 L7React 中 scene 和 layer 同时销毁的情况
|
||||
this.rendererService.destroy();
|
||||
})
|
||||
|
||||
this.map.destroy();
|
||||
|
||||
this.interactionService.destroy();
|
||||
|
|
|
@ -116,9 +116,11 @@ export default React.memo(function Map() {
|
|||
bottom: 0,
|
||||
}}
|
||||
onSceneLoaded={(scene) => {
|
||||
// setTimeout(() => {
|
||||
setTimeout(() => {
|
||||
// scene.removeAllLayer()
|
||||
// }, 3000)
|
||||
// scene.destroy()
|
||||
|
||||
}, 3000)
|
||||
// setTimeout(() => scene.destroy(), 5000)
|
||||
}}
|
||||
>
|
||||
|
|
Loading…
Reference in New Issue