UniLat3D commited on
Commit
8eca6f1
·
verified ·
1 Parent(s): 6677601

Use Loading wording for 3D mesh progress

Browse files
Files changed (1) hide show
  1. hf_space/mesh_progress.js +6 -6
hf_space/mesh_progress.js CHANGED
@@ -22,12 +22,12 @@
22
  clearTimeout(hideTimer);
23
  activeURL = url;
24
  const token = ++version;
25
- show('Downloading 3D model…');
26
  return token;
27
  };
28
  const complete = token => {
29
  if (token !== version) return;
30
- show('Model download complete · 100%', 100);
31
  // This completion describes the download, not an inferred rendering percentage.
32
  hideTimer = setTimeout(() => {
33
  if (token === version && bar()) bar().hidden = true;
@@ -43,18 +43,18 @@
43
  if (token !== version) return;
44
  if (event.lengthComputable && event.total > 0) {
45
  const percent = Math.floor(event.loaded / event.total * 100);
46
- show(`Downloading 3D model · ${percent}%`, percent);
47
  } else {
48
- show(`Downloading 3D model · ${(event.loaded / 1048576).toFixed(1)} MB`);
49
  }
50
  });
51
  this.addEventListener('load', () => {
52
  if (token !== version) return;
53
  if (this.status >= 200 && this.status < 300) complete(token);
54
- else show('Model download failed. Please select the example again.');
55
  });
56
  this.addEventListener('error', () => {
57
- if (token === version) show('Model download failed. Please select the example again.');
58
  });
59
  this.addEventListener('abort', () => {
60
  if (token === version && bar()) bar().hidden = true;
 
22
  clearTimeout(hideTimer);
23
  activeURL = url;
24
  const token = ++version;
25
+ show('Loading 3D model…');
26
  return token;
27
  };
28
  const complete = token => {
29
  if (token !== version) return;
30
+ show('Loading 3D model · 100%', 100);
31
  // This completion describes the download, not an inferred rendering percentage.
32
  hideTimer = setTimeout(() => {
33
  if (token === version && bar()) bar().hidden = true;
 
43
  if (token !== version) return;
44
  if (event.lengthComputable && event.total > 0) {
45
  const percent = Math.floor(event.loaded / event.total * 100);
46
+ show(`Loading 3D model · ${percent}%`, percent);
47
  } else {
48
+ show(`Loading 3D model · ${(event.loaded / 1048576).toFixed(1)} MB`);
49
  }
50
  });
51
  this.addEventListener('load', () => {
52
  if (token !== version) return;
53
  if (this.status >= 200 && this.status < 300) complete(token);
54
+ else show('Could not load model. Please select the example again.');
55
  });
56
  this.addEventListener('error', () => {
57
+ if (token === version) show('Could not load model. Please select the example again.');
58
  });
59
  this.addEventListener('abort', () => {
60
  if (token === version && bar()) bar().hidden = true;