Use Loading wording for 3D mesh progress
Browse files
hf_space/mesh_progress.js
CHANGED
|
@@ -22,12 +22,12 @@
|
|
| 22 |
clearTimeout(hideTimer);
|
| 23 |
activeURL = url;
|
| 24 |
const token = ++version;
|
| 25 |
-
show('
|
| 26 |
return token;
|
| 27 |
};
|
| 28 |
const complete = token => {
|
| 29 |
if (token !== version) return;
|
| 30 |
-
show('
|
| 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(`
|
| 47 |
} else {
|
| 48 |
-
show(`
|
| 49 |
}
|
| 50 |
});
|
| 51 |
this.addEventListener('load', () => {
|
| 52 |
if (token !== version) return;
|
| 53 |
if (this.status >= 200 && this.status < 300) complete(token);
|
| 54 |
-
else show('
|
| 55 |
});
|
| 56 |
this.addEventListener('error', () => {
|
| 57 |
-
if (token === version) show('
|
| 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;
|