Re-add reading of mapillary image from URL (re: #7885, #6398)

This commit is contained in:
Quincy Morgan
2020-09-13 17:09:35 -04:00
parent 9510578107
commit 21c86c6d6d
2 changed files with 19 additions and 7 deletions
+18
View File
@@ -1,5 +1,6 @@
import { dispatch as d3_dispatch } from 'd3-dispatch';
import { services } from '../services';
import { utilRebind } from '../util/rebind';
import { utilQsString, utilStringQs } from '../util';
@@ -81,6 +82,23 @@ export function rendererPhotos(context) {
if (layer) layer.enabled(true);
});
}
if (hash.photo) {
var photoIds = hash.photo.replace(/;/g, ',').split(',');
var photoId = photoIds.length && photoIds[0].trim();
var results = /(.*)-(.*)/g.exec(photoId);
if (results && results.length >= 3) {
var serviceId = results[1];
var photoKey = results[2];
var service = services[serviceId];
if (service.ensureViewerLoaded) {
service.ensureViewerLoaded(context)
.then(function() {
service.updateViewer(context, photoKey);
service.showViewer(context);
});
}
}
}
context.layers().on('change.rendererPhotos', updateStorage);
};
+1 -7
View File
@@ -448,12 +448,6 @@ export default {
})
.then(function() {
that.initViewer(context);
var hash = utilStringQs(window.location.hash);
if (hash.photo) {
that.updateViewer(context, hash.photo);
that.showViewer(context);
}
});
return _loadViewerPromise;
@@ -546,7 +540,7 @@ export default {
if (!window.mocha) {
var hash = utilStringQs(window.location.hash);
if (imageKey) {
hash.photo = imageKey;
hash.photo = 'mapillary-' + imageKey;
} else {
delete hash.photo;
}