Don't initialize Mapillary viewer with a key

(closes #4536)

This avoids binding the viewer to an image key that might not be
fully processed, which gets the viewer into a bad state.

Instead, we initialize the viewer with a `null` image key and
issue `moveToKey` immediately.

This commit also adds exception handling for moveToKey.
This commit is contained in:
Bryan Housel
2018-01-26 15:45:53 -05:00
parent db96246ddf
commit 9ebf3b11a4
+5 -2
View File
@@ -514,7 +514,8 @@ export default {
if (!_mlyViewer) {
this.initViewer(imageKey, context);
} else {
_mlyViewer.moveToKey(imageKey);
_mlyViewer.moveToKey(imageKey)
.catch(function(e) { console.error('mly3', e); }); // eslint-disable-line no-console
}
return this;
@@ -533,8 +534,10 @@ export default {
}
};
_mlyViewer = new Mapillary.Viewer('mly', clientId, imageKey, opts);
_mlyViewer = new Mapillary.Viewer('mly', clientId, null, opts);
_mlyViewer.on('nodechanged', nodeChanged);
_mlyViewer.moveToKey(imageKey)
.catch(function(e) { console.error('mly3', e); }); // eslint-disable-line no-console
}
// nodeChanged: called after the viewer has changed images and is ready.