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

fix default flyto on 3dmap

parent 024071cd
...@@ -30,13 +30,14 @@ $('body').on('click','.btn, .nav-item, logo, .video-item', function(e) { ...@@ -30,13 +30,14 @@ $('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 !== null) {
if (episode_nr.length == 2) { if (episode_nr.length == 2) {
episode_nr = episode_nr[1]; episode_nr = episode_nr[1];
$.getJSON( "/geojson/camera.json", function( data ) { $.getJSON( "/geojson/camera.json", function( data ) {
var camera_data = data[episode_nr]; var camera_data = data[episode_nr];
console.log(camera_data["center"]); console.log(camera_data["center"]);
map.flyTo({ map.flyTo({
center: camera_data["center"], //[8.404, 49.0150] center: camera_data["center"],
zoom: camera_data["zoom"], zoom: camera_data["zoom"],
pitch: camera_data["pitch"], pitch: camera_data["pitch"],
bearing: camera_data["bearing"], bearing: camera_data["bearing"],
...@@ -47,6 +48,18 @@ function camera_fly_to_object(url) { ...@@ -47,6 +48,18 @@ function camera_fly_to_object(url) {
}); });
}); });
} }
} else {
map.flyTo({
center: [8.4045457, 49.014564],
zoom: 19.13,
pitch: 60,
bearing: 64.01,
speed: 0.5,
easing: function (t) {
return t;
}
});
}
} }
function load_page(url, title, slug) { function load_page(url, title, slug) {
......
...@@ -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() {
if (window.location.pathname === "/" ||
window.location.pathname === "/about" ||
window.location.pathname === "/overview") {
map.flyTo({ map.flyTo({
center: [8.404, 49.0150], center: [8.4045457, 49.014564],
zoom: 17, zoom: 19.13,
pitch: 40, pitch: 60,
bearing: 20, bearing: 64.01,
speed: 0.5, speed: 0.5,
easing: function (t) { easing: function (t) {
return 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