Commit 99fc22a9 authored by Jonas Heinrich's avatar Jonas Heinrich

fix default flyto on 3dmap

parent 024071cd
...@@ -30,22 +30,35 @@ $('body').on('click','.btn, .nav-item, logo, .video-item', function(e) { ...@@ -30,22 +30,35 @@ $('body').on('click','.btn, .nav-item, logo, .video-item', function(e) {
function camera_fly_to_object(url) { function camera_fly_to_object(url) {
var episode_nr = url.match(/\/video\/video(\d+).html/); var episode_nr = url.match(/\/video\/video(\d+).html/);
if (episode_nr.length == 2) { if (episode_nr !== null) {
episode_nr = episode_nr[1]; if (episode_nr.length == 2) {
$.getJSON( "/geojson/camera.json", function( data ) { episode_nr = episode_nr[1];
var camera_data = data[episode_nr]; $.getJSON( "/geojson/camera.json", function( data ) {
console.log(camera_data["center"]); var camera_data = data[episode_nr];
console.log(camera_data["center"]);
map.flyTo({
center: camera_data["center"],
zoom: camera_data["zoom"],
pitch: camera_data["pitch"],
bearing: camera_data["bearing"],
speed: 0.5,
easing: function (t) {
return t;
}
});
});
}
} else {
map.flyTo({ map.flyTo({
center: camera_data["center"], //[8.404, 49.0150] center: [8.4045457, 49.014564],
zoom: camera_data["zoom"], zoom: 19.13,
pitch: camera_data["pitch"], pitch: 60,
bearing: camera_data["bearing"], bearing: 64.01,
speed: 0.5, speed: 0.5,
easing: function (t) { easing: function (t) {
return t; return t;
} }
}); });
});
} }
} }
......
...@@ -19,16 +19,20 @@ map.addControl(new mapboxgl.NavigationControl()); ...@@ -19,16 +19,20 @@ map.addControl(new mapboxgl.NavigationControl());
map.on('load', function() { map.on('load', function() {
map.flyTo({ if (window.location.pathname === "/" ||
center: [8.404, 49.0150], window.location.pathname === "/about" ||
zoom: 17, window.location.pathname === "/overview") {
pitch: 40, map.flyTo({
bearing: 20, center: [8.4045457, 49.014564],
speed: 0.5, zoom: 19.13,
easing: function (t) { pitch: 60,
return t; bearing: 64.01,
} speed: 0.5,
}); easing: function (t) {
return t;
}
});
}
map.on('moveend', function(e){ map.on('moveend', function(e){
map.setMaxBounds(bounds); map.setMaxBounds(bounds);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment