Commit 3556298d authored by Jonas Heinrich's avatar Jonas Heinrich

setMaxBounds after moveend of flight

parent da290785
...@@ -16,45 +16,23 @@ var map = new mapboxgl.Map({ ...@@ -16,45 +16,23 @@ var map = new mapboxgl.Map({
bearing: 0 bearing: 0
}); });
// maxBounds: bounds,
map.addControl(new mapboxgl.NavigationControl()); map.addControl(new mapboxgl.NavigationControl());
map.on('load', function() { map.on('load', function() {
map.fire('flystart');
map.flyTo({ map.flyTo({
// These options control the ending camera position: centered at
// the target, at zoom level 9, and north up.
center: [8.404, 49.0150], center: [8.404, 49.0150],
zoom: 17, zoom: 17,
pitch: 40, pitch: 40,
bearing: 20, bearing: 20,
speed: 0.5,
// These options control the flight curve, making it move
// slowly and zoom out almost completely before starting
// to pan.
speed: 0.5, // make the flying slow
curve: 1, // change the speed at which it zooms out
// This can be any easing function: it takes a number between
// 0 and 1 and returns another number between 0 and 1.
easing: function (t) { easing: function (t) {
return t; return t;
} }
}); });
map.on('moveend', function(e){ map.on('moveend', function(e){
if(flying) { map.setMaxBounds(bounds);
map.fire('flyend');
}
});
map.on('flystart', function(){
flying = true;
});
map.on('flyend', function(){
flying = false;
}); });
// Insert the layer beneath any symbol layer. // Insert the layer beneath any symbol layer.
...@@ -77,7 +55,6 @@ map.on('load', function() { ...@@ -77,7 +55,6 @@ map.on('load', function() {
'minzoom': 15, 'minzoom': 15,
'paint': { 'paint': {
'fill-extrusion-color': '#aaa', 'fill-extrusion-color': '#aaa',
// use an 'interpolate' expression to add a smooth transition effect to the // use an 'interpolate' expression to add a smooth transition effect to the
// buildings as the user zooms in // buildings as the user zooms in
'fill-extrusion-height': [ 'fill-extrusion-height': [
......
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