circumvent leaflet racing condition #918 by switching off animation

during initialization
This commit is contained in:
DennisSchiefer 2012-08-22 07:25:45 +01:00
parent 792404b311
commit f571b5c7e5
2 changed files with 11 additions and 2 deletions

View File

@ -51,8 +51,8 @@ init: function() {
center: new L.LatLng(OSRM.DEFAULTS.ONLOAD_LATITUDE, OSRM.DEFAULTS.ONLOAD_LONGITUDE),
zoom: OSRM.DEFAULTS.ONLOAD_ZOOM_LEVEL,
layers: [base_maps[tile_servers[0].display_name]],
zoomAnimation: true, // remove animations -> routes are not hidden during zoom
fadeAnimation: true
zoomAnimation: false, // animations have to be inactive during initialization (leaflet issue #918)
fadeAnimation: false
});
// add layer control
@ -75,6 +75,12 @@ init: function() {
OSRM.G.map.on('contextmenu', OSRM.Map.contextmenu );
OSRM.G.map.on('mousemove', OSRM.Map.mousemove );
},
initFinally: function() {
L.Util.setOptions( OSRM.G.map, {
zoomAnimation: true,
fadeAnimation: true
} );
},
// init map position and zoom (respect UI visibility / use browser geolocation)
initPosition: function() {

View File

@ -42,6 +42,9 @@ OSRM.init = function() {
// only init default position / geolocation position if GET parameters do not specify a different one
if( OSRM.G.initial_position_override == false )
OSRM.Map.initPosition();
// finalize initialization of map
OSRM.Map.initFinally();
};