Merge branch 'dev'
This commit is contained in:
commit
073bf80cbd
@ -142,6 +142,14 @@
|
|||||||
<div class="parameter_main">
|
<div class="parameter_main">
|
||||||
<div class="parameter_description">Callback that is called when the model with all of the textures is fully loaded.</div>
|
<div class="parameter_description">Callback that is called when the model with all of the textures is fully loaded.</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="parameter_header">
|
||||||
|
<span class="parameter_name">onModelLoadFailed</span>
|
||||||
|
<span class="type parameter_type">function</span>
|
||||||
|
<span class="parameter_attributes">(optional)</span>
|
||||||
|
</div>
|
||||||
|
<div class="parameter_main">
|
||||||
|
<div class="parameter_description">Callback that is called when the model load failed.</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<h2>Methods</h2>
|
<h2>Methods</h2>
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "online-3d-viewer",
|
"name": "online-3d-viewer",
|
||||||
"version": "0.16.0",
|
"version": "0.17.0",
|
||||||
"description": "Online 3D Viewer",
|
"description": "Online 3D Viewer",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@ -31,6 +31,7 @@ export class EmbeddedViewer
|
|||||||
* @param {EnvironmentSettings} [parameters.environmentSettings] Environment settings.
|
* @param {EnvironmentSettings} [parameters.environmentSettings] Environment settings.
|
||||||
* @param {function} [parameters.onModelLoaded] Callback that is called when the model with all
|
* @param {function} [parameters.onModelLoaded] Callback that is called when the model with all
|
||||||
* of the textures is fully loaded.
|
* of the textures is fully loaded.
|
||||||
|
* @param {function} [parameters.onModelLoadFailed] Callback that is called when the model load failed.
|
||||||
*/
|
*/
|
||||||
constructor (parentElement, parameters)
|
constructor (parentElement, parameters)
|
||||||
{
|
{
|
||||||
@ -69,6 +70,7 @@ export class EmbeddedViewer
|
|||||||
this.model = null;
|
this.model = null;
|
||||||
this.modelLoader = new ThreeModelLoader ();
|
this.modelLoader = new ThreeModelLoader ();
|
||||||
|
|
||||||
|
this.progressDiv = null;
|
||||||
window.addEventListener ('resize', () => {
|
window.addEventListener ('resize', () => {
|
||||||
this.Resize ();
|
this.Resize ();
|
||||||
});
|
});
|
||||||
@ -120,26 +122,30 @@ export class EmbeddedViewer
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.model = null;
|
this.model = null;
|
||||||
let progressDiv = null;
|
if (this.progressDiv !== null) {
|
||||||
|
this.parentElement.removeChild (this.progressDiv);
|
||||||
|
this.progressDiv = null;
|
||||||
|
}
|
||||||
this.modelLoader.LoadModel (inputFiles, settings, {
|
this.modelLoader.LoadModel (inputFiles, settings, {
|
||||||
onLoadStart : () => {
|
onLoadStart : () => {
|
||||||
this.canvas.style.display = 'none';
|
this.canvas.style.display = 'none';
|
||||||
progressDiv = document.createElement ('div');
|
this.progressDiv = document.createElement ('div');
|
||||||
progressDiv.innerHTML = Loc ('Loading model...');
|
this.progressDiv.innerHTML = Loc ('Loading model...');
|
||||||
this.parentElement.appendChild (progressDiv);
|
this.parentElement.appendChild (this.progressDiv);
|
||||||
},
|
},
|
||||||
onFileListProgress : (current, total) => {
|
onFileListProgress : (current, total) => {
|
||||||
},
|
},
|
||||||
onFileLoadProgress : (current, total) => {
|
onFileLoadProgress : (current, total) => {
|
||||||
},
|
},
|
||||||
onImportStart : () => {
|
onImportStart : () => {
|
||||||
progressDiv.innerHTML = Loc ('Importing model...');
|
this.progressDiv.innerHTML = Loc ('Importing model...');
|
||||||
},
|
},
|
||||||
onVisualizationStart : () => {
|
onVisualizationStart : () => {
|
||||||
progressDiv.innerHTML = Loc ('Visualizing model...');
|
this.progressDiv.innerHTML = Loc ('Visualizing model...');
|
||||||
},
|
},
|
||||||
onModelFinished : (importResult, threeObject) => {
|
onModelFinished : (importResult, threeObject) => {
|
||||||
this.parentElement.removeChild (progressDiv);
|
this.parentElement.removeChild (this.progressDiv);
|
||||||
|
this.progressDiv = null;
|
||||||
this.canvas.style.display = 'inherit';
|
this.canvas.style.display = 'inherit';
|
||||||
this.viewer.SetMainObject (threeObject);
|
this.viewer.SetMainObject (threeObject);
|
||||||
let boundingSphere = this.viewer.GetBoundingSphere ((meshUserData) => {
|
let boundingSphere = this.viewer.GetBoundingSphere ((meshUserData) => {
|
||||||
@ -173,7 +179,10 @@ export class EmbeddedViewer
|
|||||||
if (importError.message !== null) {
|
if (importError.message !== null) {
|
||||||
message += ' (' + importError.message + ')';
|
message += ' (' + importError.message + ')';
|
||||||
}
|
}
|
||||||
progressDiv.innerHTML = message;
|
this.progressDiv.innerHTML = message;
|
||||||
|
if (this.parameters.onModelLoadFailed) {
|
||||||
|
this.parameters.onModelLoadFailed ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user