From 92dbadebaec2fe11f0532e1aeeef5d965d732ddd Mon Sep 17 00:00:00 2001 From: DennisSchiefer Date: Sun, 18 Mar 2012 18:17:04 +0100 Subject: [PATCH] increased zoom level for route description (new config entry), removed some deprecated comments --- WebContent/OSRM.Markers.js | 8 +++----- WebContent/OSRM.config.js | 1 + WebContent/geocoder.js | 7 ++++--- WebContent/main.js | 2 +- WebContent/routing.js | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/WebContent/OSRM.Markers.js b/WebContent/OSRM.Markers.js index b1f117ae0..97dca3f34 100644 --- a/WebContent/OSRM.Markers.js +++ b/WebContent/OSRM.Markers.js @@ -58,11 +58,9 @@ getLng: function() { isShown: function() { return this.shown; }, -centerView: function(zooming) { - var zoom = OSRM.DEFAULTS.ZOOM_LEVEL; - if( zooming == false ) - zoom = OSRM.G.map.getZoom(); - //OSRM.G.map.setView( new L.LatLng( this.position.lat, this.position.lng-0.02), zoom); // dirty hack +centerView: function(zoom) { + if( zoom == undefined ) + zoom = OSRM.DEFAULTS.ZOOM_LEVEL; OSRM.G.map.setView( new L.LatLng( this.position.lat, this.position.lng), zoom); }, toString: function() { diff --git a/WebContent/OSRM.config.js b/WebContent/OSRM.config.js index 0348b0554..ba44bef86 100644 --- a/WebContent/OSRM.config.js +++ b/WebContent/OSRM.config.js @@ -30,6 +30,7 @@ OSRM.DEFAULTS = { ONLOAD_LONGITUDE: 10.10, ONLOAD_SOURCE: "", ONLOAD_TARGET: "", + HIGHLIGHT_ZOOM_LEVEL: 16, LANGUAGE: "en", GEOCODER_BOUNDS: '&bounded=1&viewbox=-27.0,72.0,46.0,36.0' }; diff --git a/WebContent/geocoder.js b/WebContent/geocoder.js index ea956ac1b..02e4105c5 100644 --- a/WebContent/geocoder.js +++ b/WebContent/geocoder.js @@ -63,7 +63,7 @@ function callGeocoder(marker_id, query) { // helper function for clicks on geocoder search results -function onclickGeocoderResult(marker_id, lat, lon, do_reverse_geocode, zoom ) { +function onclickGeocoderResult(marker_id, lat, lon, do_reverse_geocode, do_zoom ) { var index; if( marker_id == OSRM.C.SOURCE_LABEL ) index = OSRM.G.markers.setSource( new L.LatLng(lat, lon) ); @@ -74,8 +74,9 @@ function onclickGeocoderResult(marker_id, lat, lon, do_reverse_geocode, zoom ) { if( do_reverse_geocode == true ) updateReverseGeocoder(marker_id); - if( zoom == undefined ) - zoom = true; + var zoom = undefined; + if( do_zoom == false ) + zoom = OSRM.G.map.getZoom(); OSRM.G.markers.route[index].show(); if( !OSRM.G.markers.route[index].dirty_move || OSRM.G.markers.route[index].dirty_type ) diff --git a/WebContent/main.js b/WebContent/main.js index 97a3527fd..c622c99a5 100644 --- a/WebContent/main.js +++ b/WebContent/main.js @@ -93,7 +93,7 @@ function initLocale() { // centering on geolocation function callbak_centerOnGeolocation( position ) { - OSRM.G.map.setView( new L.LatLng( position.coords.latitude, position.coords.longitude-0.02), OSRM.DEFAULTS.ZOOM_LEVEL); + OSRM.G.map.setView( new L.LatLng( position.coords.latitude, position.coords.longitude), OSRM.DEFAULTS.ZOOM_LEVEL); } function centerOnGeolocation() { if (navigator.geolocation) diff --git a/WebContent/routing.js b/WebContent/routing.js index efe1ac623..31f3d9764 100644 --- a/WebContent/routing.js +++ b/WebContent/routing.js @@ -122,7 +122,7 @@ function onClickRouteDescription(geometry_index) { OSRM.G.markers.highlight.setPosition( positions[geometry_index] ); OSRM.G.markers.highlight.show(); - OSRM.G.markers.highlight.centerView(); + OSRM.G.markers.highlight.centerView(OSRM.DEFAULTS.HIGHLIGHT_ZOOM_LEVEL); } function onClickCreateShortcut(src){ OSRM.JSONP.call(OSRM.DEFAULTS.HOST_SHORTENER_URL+src+'&jsonp=showRouteLink', showRouteLink, showRouteLink_TimeOut, 2000, 'shortener');