Skip to content

When fails to load image within 1s, may be can remove the CLASS_LOADING too. #502

@wggit2020

Description

@wggit2020

Is your feature request related to a problem? Please describe.
When I request an image that does not exist, wait a moment, the little break icon will visible in the left corner, but the loading is still in the center.

Describe the solution you'd like
I think in the case, it maybe better to stop the loading and show a break icon in the center. (There is also loading in the viewer-navbar)

Describe alternatives you've considered
None.

Additional context
None.

Some ways

// method.js
// Make the image visible if it fails to load within 1s
this.timeout = setTimeout(() => {
  removeClass(image, CLASS_INVISIBLE);

  // here are the new code, remove the loading too
  if (this.options.loading) {
    removeClass(this.canvas, CLASS_LOADING);
  }
  // can remove the icon to the center
  image.style.cssText = (
    'height:0;'
    + `margin-left:${this.viewerData.width / 2}px;`
    + `margin-top:${this.viewerData.height / 2}px;`
    + 'max-width:none!important;'
    + 'position:relative;'
    + 'width:0;'
  );

  this.timeout = false;
}, 1000);

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions