coords from url hash

0.1
Michael Blix 2014-02-25 17:03:47 -05:00
rodzic 62387679fd
commit 43619e5df6
2 zmienionych plików z 7 dodań i 1 usunięć

Wyświetl plik

@ -30,7 +30,7 @@
var city = new VIZI.City();
city.init({
coords: [-0.01924, 51.50358] // Canary Wharf
// coords: [-0.01924, 51.50358] // Canary Wharf
// coords: [-0.1159894466, 51.5045487479] // London Eye
// coords: [-73.984762, 40.7516199] // NYC (performance-heavy)
});

Wyświetl plik

@ -53,6 +53,12 @@
options = {};
}
var hash = window.location.hash.replace('#', '');
var coordCheck = /^(\-?\d+(\.\d+)?),(\-?\d+(\.\d+)?)$/;
if (coordCheck.test(hash) && !_.has(options, 'coords')) {
options.coords = hash.split(',');
}
_.defaults(options, {
coords: [-0.01924, 51.50358]
});