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({
bearing: 0
});
// maxBounds: bounds,
map.addControl(new mapboxgl.NavigationControl());
map.on('load', function() {
map.fire('flystart');
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],
zoom: 17,
pitch: 40,
bearing: 20,
// 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.
speed: 0.5,
easing: function (t) {
return t;
}
});
map.on('moveend', function(e){
if(flying) {
map.fire('flyend');
}
});
map.on('flystart', function(){
flying = true;
});
map.on('flyend', function(){
flying = false;
map.setMaxBounds(bounds);
});
// Insert the layer beneath any symbol layer.
......@@ -77,7 +55,6 @@ map.on('load', function() {
'minzoom': 15,
'paint': {
'fill-extrusion-color': '#aaa',
// use an 'interpolate' expression to add a smooth transition effect to the
// buildings as the user zooms in
'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