added onload_zoomlevel

This commit is contained in:
DennisSchiefer 2012-04-16 19:39:47 +02:00
parent 6f4e9a1d11
commit c14e461370
2 changed files with 3 additions and 2 deletions

View File

@ -82,7 +82,7 @@ init: function() {
// setup map // setup map
OSRM.G.map = new OSRM.MapView('map', { OSRM.G.map = new OSRM.MapView('map', {
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.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: false, // remove animations -> routes are not hidden during zoom zoomAnimation: false, // remove animations -> routes are not hidden during zoom
fadeAnimation: false fadeAnimation: false
@ -98,7 +98,7 @@ init: function() {
// initial correct map position and zoom (respect UI visibility, use browser position) // initial correct map position and zoom (respect UI visibility, use browser position)
var position = new L.LatLng( OSRM.DEFAULTS.ONLOAD_LATITUDE, OSRM.DEFAULTS.ONLOAD_LONGITUDE); var position = new L.LatLng( OSRM.DEFAULTS.ONLOAD_LATITUDE, OSRM.DEFAULTS.ONLOAD_LONGITUDE);
OSRM.G.map.setViewUI( position, OSRM.DEFAULTS.ZOOM_LEVEL); OSRM.G.map.setViewUI( position, OSRM.DEFAULTS.ONLOAD_ZOOM_LEVEL);
if (navigator.geolocation && document.URL.indexOf("file://") == -1) // convenience during development, as FF doesn't save rights for local files if (navigator.geolocation && document.URL.indexOf("file://") == -1) // convenience during development, as FF doesn't save rights for local files
navigator.geolocation.getCurrentPosition(OSRM.Map.geolocationResponse); navigator.geolocation.getCurrentPosition(OSRM.Map.geolocationResponse);

View File

@ -26,6 +26,7 @@ OSRM.DEFAULTS = {
WEBSITE_URL: document.URL.replace(/#*(\?.*|$)/i,""), // truncates URL before first ?, and removes tailing # WEBSITE_URL: document.URL.replace(/#*(\?.*|$)/i,""), // truncates URL before first ?, and removes tailing #
JSONP_TIMEOUT: 10000, JSONP_TIMEOUT: 10000,
ZOOM_LEVEL: 14, ZOOM_LEVEL: 14,
ONLOAD_ZOOM_LEVEL: 5,
ONLOAD_LATITUDE: 48.84, ONLOAD_LATITUDE: 48.84,
ONLOAD_LONGITUDE: 10.10, ONLOAD_LONGITUDE: 10.10,
ONLOAD_SOURCE: "", ONLOAD_SOURCE: "",