Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

销毁地图得时候会出现错误 #28

Open
wangjiahao123456 opened this issue Aug 7, 2024 · 1 comment
Open

销毁地图得时候会出现错误 #28

wangjiahao123456 opened this issue Aug 7, 2024 · 1 comment

Comments

@wangjiahao123456
Copy link

cesium版本:1.114
iClient3D-for-WebGL版本:最新

/**
 * 销毁地图代码
 */
export function viewerDestroy(viewer){
  if(viewer){
    // @ts-ignore
    let _originalGLContext = viewer.scene?.context._originalGLContext;
    try{
      viewer.entities.removeAll();
      viewer.imageryLayers.removeAll();
      viewer.dataSources.removeAll();
      viewer.destroy();
    }catch (e) {
      console.error(e);
    }
    if(_originalGLContext){
      _originalGLContext.getExtension("WEBGL_lose_context").loseContext();
      _originalGLContext = null;
    }
  }
}

错误信息
1723023045874

@xiuyulin
Copy link

在对应的加上代码上Cesium.defined就好

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants