mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 21:48:20 +02:00
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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user