circumvent leaflet racing condition #918 by switching off animation
during initialization
This commit is contained in:
parent
792404b311
commit
f571b5c7e5
@ -51,8 +51,8 @@ init: function() {
|
|||||||
center: new L.LatLng(OSRM.DEFAULTS.ONLOAD_LATITUDE, OSRM.DEFAULTS.ONLOAD_LONGITUDE),
|
center: new L.LatLng(OSRM.DEFAULTS.ONLOAD_LATITUDE, OSRM.DEFAULTS.ONLOAD_LONGITUDE),
|
||||||
zoom: OSRM.DEFAULTS.ONLOAD_ZOOM_LEVEL,
|
zoom: OSRM.DEFAULTS.ONLOAD_ZOOM_LEVEL,
|
||||||
layers: [base_maps[tile_servers[0].display_name]],
|
layers: [base_maps[tile_servers[0].display_name]],
|
||||||
zoomAnimation: true, // remove animations -> routes are not hidden during zoom
|
zoomAnimation: false, // animations have to be inactive during initialization (leaflet issue #918)
|
||||||
fadeAnimation: true
|
fadeAnimation: false
|
||||||
});
|
});
|
||||||
|
|
||||||
// add layer control
|
// add layer control
|
||||||
@ -75,6 +75,12 @@ init: function() {
|
|||||||
OSRM.G.map.on('contextmenu', OSRM.Map.contextmenu );
|
OSRM.G.map.on('contextmenu', OSRM.Map.contextmenu );
|
||||||
OSRM.G.map.on('mousemove', OSRM.Map.mousemove );
|
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)
|
// init map position and zoom (respect UI visibility / use browser geolocation)
|
||||||
initPosition: function() {
|
initPosition: function() {
|
||||||
|
@ -42,6 +42,9 @@ OSRM.init = function() {
|
|||||||
// only init default position / geolocation position if GET parameters do not specify a different one
|
// only init default position / geolocation position if GET parameters do not specify a different one
|
||||||
if( OSRM.G.initial_position_override == false )
|
if( OSRM.G.initial_position_override == false )
|
||||||
OSRM.Map.initPosition();
|
OSRM.Map.initPosition();
|
||||||
|
|
||||||
|
// finalize initialization of map
|
||||||
|
OSRM.Map.initFinally();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user