diff --git a/CHANGES.md b/CHANGES.md index 0ae9275b9ad..18203f7ba5c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,6 +5,7 @@ Change Log ##### Fixes :wrench: * Fixed support of glTF-supplied tangent vectors. [#6302](https://github.com/AnalyticalGraphicsInc/cesium/pull/6302) +* Fixed improper zoom during model load failure. [#6305](https://github.com/AnalyticalGraphicsInc/cesium/pull/6305) ### 1.43 - 2018-03-01 diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index f7da17c53bc..bc6872cb789 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -171,3 +171,4 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu * [Nacho Carnicero](https://github.com/nacho-carnicero) * [Y.Selim Abidin](https://github.com/SelimAbidin) * [Tamar Cohen](https://github.com/tamarmot) +* [Stephen Wiseman](https://github.com/srwiseman) diff --git a/Source/DataSources/ModelVisualizer.js b/Source/DataSources/ModelVisualizer.js index 68779e161e5..37954219c7a 100644 --- a/Source/DataSources/ModelVisualizer.js +++ b/Source/DataSources/ModelVisualizer.js @@ -126,9 +126,6 @@ define([ incrementallyLoadTextures : Property.getValueOrDefault(modelGraphics._incrementallyLoadTextures, time, defaultIncrementallyLoadTextures), scene : this._scene }); - - model.readyPromise.otherwise(onModelError); - model.id = entity; primitives.add(model); @@ -137,9 +134,12 @@ define([ url : resource.url, animationsRunning : false, nodeTransformationsScratch : {}, - originalNodeMatrixHash : {} + originalNodeMatrixHash : {}, + loadFail : false }; modelHash[entity.id] = modelData; + + checkModelLoad(model, entity, modelHash); } model.show = true; @@ -250,7 +250,7 @@ define([ //>>includeEnd('debug'); var modelData = this._modelHash[entity.id]; - if (!defined(modelData)) { + if (!defined(modelData) || modelData.loadFail) { return BoundingSphereState.FAILED; } @@ -324,8 +324,11 @@ define([ } } - function onModelError(error) { - console.error(error); + function checkModelLoad(model, entity, modelHash){ + model.readyPromise.otherwise(function(error){ + console.error(error); + modelHash[entity.id].loadFail = true; + }); } return ModelVisualizer;