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) {
function camera_fly_to_object(url) {
var episode_nr = url.match(/\/video\/video(\d+).html/);
if (episode_nr.length == 2) {
episode_nr = episode_nr[1];
$.getJSON( "/geojson/camera.json", function( data ) {
var camera_data = data[episode_nr];
console.log(camera_data["center"]);
if (episode_nr !== null) {
if (episode_nr.length == 2) {
episode_nr = episode_nr[1];
$.getJSON( "/geojson/camera.json", function( data ) {
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({
center: camera_data["center"], //[8.404, 49.0150]
zoom: camera_data["zoom"],
pitch: camera_data["pitch"],
bearing: camera_data["bearing"],
center: [8.4045457, 49.014564],
zoom: 19.13,
pitch: 60,
bearing: 64.01,
speed: 0.5,
easing: function (t) {
return t;
}
});
});
}
}
......
......@@ -19,16 +19,20 @@ map.addControl(new mapboxgl.NavigationControl());
map.on('load', function() {
map.flyTo({
center: [8.404, 49.0150],
zoom: 17,
pitch: 40,
bearing: 20,
speed: 0.5,
easing: function (t) {
return t;
}
});
if (window.location.pathname === "/" ||
window.location.pathname === "/about" ||
window.location.pathname === "/overview") {
map.flyTo({
center: [8.4045457, 49.014564],
zoom: 19.13,
pitch: 60,
bearing: 64.01,
speed: 0.5,
easing: function (t) {
return t;
}
});
}
map.on('moveend', function(e){
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