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

Spinner - using a custom spinner result in getting a lost dom element #1524

Open
de-buddy opened this issue Jun 6, 2024 · 0 comments
Open

Comments

@de-buddy
Copy link

de-buddy commented Jun 6, 2024

Describe the bug

While using the viewer, we use a custom spinner.

But this dom element can get lost/destroyed.

The reason in (dist/xeokit-sdk.es.js Line: 15060....):
´this._isCustom = false;seems to be always false. When_destroy()` is called internally,

Line 15190...
_destroy() {
    if (this._element && (!this._isCustom)) {
              //                 ^^^^^^ custom was used but here never set to something positive. Its always false
              // remove element: in this case also our custom spinner:
        this._element.parentNode.removeChild(this._element);
        this._element = null;
    }
    ...

eg. when re-init the viewer like viewer.destroy(); it drops our custom dom element
e.g: <div id="myspinner"...

The next creation of a viewer can not find myspinner in the dom anymore
and creates an internal spinner we can not control (in position or layout).

To Reproduce

viewer = new Viewer({
    canvasElement: viewerCanvas,
    transparent: true
    spinnerElementId: "myspinner"
}),

// ... load model/s an show

if (viewer) { 
    viewer.destroy();
}

// create a new viewer
viewer = new Viewer({
    canvasElement: viewerCanvas,
    transparent: true
    spinnerElementId: "myspinner"
}),
ERROR:
    [Spinner '__1']: Can't find given Spinner HTML element: 'myspinner' - will automatically create default element

Desktop (please complete the following information):

  • OS: Current *nix or Win Systems
  • Browser: Any current browser

Kind regards

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

1 participant