added button to zoom on current route
This commit is contained in:
parent
1973198f3d
commit
5923d034c9
@ -59,8 +59,8 @@ OSRM.extend( OSRM.Route,{
|
||||
|
||||
this._history.fetchHistoryRoute();
|
||||
this._history.showHistoryRoutes();
|
||||
// deactivate printing
|
||||
OSRM.Printing.deactivate();
|
||||
// deactivate GUI features that need a route
|
||||
OSRM.GUI.deactivateRouteFeatures();
|
||||
},
|
||||
|
||||
// show/hide highlighting for unnamed routes
|
||||
|
@ -54,6 +54,7 @@ setLabels: function() {
|
||||
document.getElementById("open-josm").innerHTML = OSRM.loc("OPEN_JOSM");
|
||||
document.getElementById("open-osmbugs").innerHTML = OSRM.loc("OPEN_OSMBUGS");
|
||||
document.getElementById("gui-reset").innerHTML = OSRM.loc("GUI_RESET");
|
||||
document.getElementById("gui-zoom").innerHTML = OSRM.loc("GUI_ZOOM");
|
||||
document.getElementById("gui-reverse").innerHTML = OSRM.loc("GUI_REVERSE");
|
||||
document.getElementById("gui-option-highlight-nonames-label").innerHTML = OSRM.loc("GUI_HIGHLIGHT_UNNAMED_ROADS");
|
||||
document.getElementById("gui-option-show-previous-routes-label").innerHTML = OSRM.loc("GUI_SHOW_PREVIOUS_ROUTES");
|
||||
|
@ -36,6 +36,7 @@ init: function() {
|
||||
document.getElementById("gui-search-target").onclick = function() {OSRM.GUI.showMarker(OSRM.C.TARGET_LABEL);};
|
||||
|
||||
document.getElementById("gui-reset").onclick = OSRM.GUI.resetRouting;
|
||||
document.getElementById("gui-zoom").onclick = OSRM.GUI.zoomOnRoute;
|
||||
document.getElementById("gui-reverse").onclick = OSRM.GUI.reverseRouting;
|
||||
document.getElementById("open-josm").onclick = OSRM.GUI.openJOSM;
|
||||
document.getElementById("open-osmbugs").onclick = OSRM.GUI.openOSMBugs;
|
||||
@ -43,6 +44,16 @@ init: function() {
|
||||
document.getElementById("option-show-previous-routes").onclick = OSRM.GUI.showPreviousRoutes;
|
||||
},
|
||||
|
||||
// toggle GUI features that need a route to work
|
||||
activateRouteFeatures: function() {
|
||||
OSRM.Printing.activate();
|
||||
document.getElementById("gui-zoom").className = "button";
|
||||
},
|
||||
deactivateRouteFeatures: function() {
|
||||
OSRM.Printing.deactivate();
|
||||
document.getElementById("gui-zoom").className = "button-inactive";
|
||||
},
|
||||
|
||||
// click: button "reset"
|
||||
resetRouting: function() {
|
||||
document.getElementById('gui-input-source').value = "";
|
||||
@ -144,6 +155,15 @@ showPreviousRoutes: function(value) {
|
||||
OSRM.G.route.deactivateHistoryRoutes();
|
||||
else
|
||||
OSRM.G.route.activateHistoryRoutes();
|
||||
},
|
||||
|
||||
//click: button "zoom on route"
|
||||
zoomOnRoute: function() {
|
||||
if( OSRM.G.route.isShown() == false )
|
||||
return;
|
||||
|
||||
var bounds = new L.LatLngBounds( OSRM.G.route._current_route.getPositions() );
|
||||
OSRM.G.map.fitBoundsUI(bounds);
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -26,6 +26,7 @@ OSRM.Localization["de"] = {
|
||||
"GUI_START": "Start",
|
||||
"GUI_END": "Ziel",
|
||||
"GUI_RESET": "Reset",
|
||||
"GUI_ZOOM": "Zoom auf Route",
|
||||
"GUI_SEARCH": "Zeigen",
|
||||
"GUI_REVERSE": "Umdrehen",
|
||||
"GUI_START_TOOLTIP": "Startposition eingeben",
|
||||
|
@ -26,6 +26,7 @@ OSRM.Localization["dk"] = {
|
||||
"GUI_START": "Start",
|
||||
"GUI_END": "Destination",
|
||||
"GUI_RESET": "Nulstil",
|
||||
"GUI_ZOOM": "Zoom på Rute",
|
||||
"GUI_SEARCH": "Vis",
|
||||
"GUI_REVERSE": "Omvendt",
|
||||
"GUI_START_TOOLTIP": "Indtast start",
|
||||
|
@ -26,6 +26,7 @@ OSRM.Localization["en"] = {
|
||||
"GUI_START": "Start",
|
||||
"GUI_END": "End",
|
||||
"GUI_RESET": " Reset ",
|
||||
"GUI_ZOOM": "Zoom on Route",
|
||||
"GUI_SEARCH": " Show ",
|
||||
"GUI_REVERSE": "Reverse",
|
||||
"GUI_START_TOOLTIP": "Enter start",
|
||||
|
@ -26,6 +26,7 @@ OSRM.Localization["fi"] = {
|
||||
"GUI_START": "Lähtöpaikka",
|
||||
"GUI_END": "Määränpää",
|
||||
"GUI_RESET": "Tyhjennä",
|
||||
"GUI_ZOOM": "Zoom reitillä",
|
||||
"GUI_SEARCH": "Etsi",
|
||||
"GUI_REVERSE": "Käänteinen reitti",
|
||||
"GUI_START_TOOLTIP": "Syötä lähtöpaikka",
|
||||
|
@ -26,6 +26,7 @@ OSRM.Localization["fr"] = {
|
||||
"GUI_START": "Départ",
|
||||
"GUI_END": "Arrivée",
|
||||
"GUI_RESET": "Réinitialiser",
|
||||
"GUI_ZOOM": "Zoom sur la Route",
|
||||
"GUI_SEARCH": "Montrer",
|
||||
"GUI_REVERSE": "Inverser",
|
||||
"GUI_START_TOOLTIP": "Entrez le lieu de départ",
|
||||
|
@ -26,6 +26,7 @@ OSRM.Localization["it"] = {
|
||||
"GUI_START": "Partenza",
|
||||
"GUI_END": "Destinazione",
|
||||
"GUI_RESET": "Reset",
|
||||
"GUI_ZOOM": "Zoom su Percorso",
|
||||
"GUI_SEARCH": "Mostra",
|
||||
"GUI_REVERSE": "Inverti",
|
||||
"GUI_START_TOOLTIP": "Inserire la Partenza",
|
||||
@ -41,7 +42,7 @@ OSRM.Localization["it"] = {
|
||||
// mapping
|
||||
"GUI_MAPPING_TOOLS": "Strumenti per la Mappatura",
|
||||
"GUI_HIGHLIGHT_UNNAMED_ROADS": "Evidenzia strade senza nome",
|
||||
"GUI_SHOW_PREVIOUS_ROUTES": "Show previous routes",
|
||||
"GUI_SHOW_PREVIOUS_ROUTES": "Mostra le percorsi precedenti",
|
||||
"OPEN_JOSM": "JOSM",
|
||||
"OPEN_OSMBUGS": "OSM Bugs",
|
||||
// geocoder
|
||||
|
@ -26,6 +26,7 @@ OSRM.Localization["pl"] = {
|
||||
"GUI_START": "Początek",
|
||||
"GUI_END": "Koniec",
|
||||
"GUI_RESET": "Reset",
|
||||
"GUI_ZOOM": "Zoom na Trasy",
|
||||
"GUI_SEARCH": "Pokaż",
|
||||
"GUI_REVERSE": "Odwróć",
|
||||
"GUI_START_TOOLTIP": "Wprowadź początek",
|
||||
|
@ -517,6 +517,21 @@ html, body {
|
||||
background-color:#F4F4F4;
|
||||
color:#FF0000;
|
||||
}
|
||||
.button-inactive
|
||||
{
|
||||
cursor:default;
|
||||
padding:2px 10px 2px 10px;
|
||||
border-radius:5px;
|
||||
-moz-border-radius:5px;
|
||||
-webkit-border-radius:5px;
|
||||
background-color:#F9F9F9;
|
||||
border:1px solid #CCCCCC;
|
||||
color:#999999;
|
||||
text-decoration:none;
|
||||
font-size:9px;
|
||||
outline-style:none;
|
||||
vertical-align:1px;
|
||||
}
|
||||
|
||||
|
||||
/* iconic buttons */
|
||||
|
@ -185,6 +185,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
<!-- action buttons -->
|
||||
<div class="full">
|
||||
<div class="left"><a class="button" id="gui-reset">Reset</a></div>
|
||||
<div class="center"><a class="button-inactive" id="gui-zoom">Reset</a></div>
|
||||
<div class="right"><a class="button" id="gui-reverse">Reverse</a></div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -48,8 +48,8 @@ showRouteLink_TimeOut: function(){
|
||||
|
||||
// handling of routing description
|
||||
show: function(response) {
|
||||
// activate printing
|
||||
OSRM.Printing.activate();
|
||||
// activate GUI features that need a route
|
||||
OSRM.GUI.activateRouteFeatures();
|
||||
|
||||
// compute query string
|
||||
var query_string = '?hl=' + OSRM.Localization.current_language;
|
||||
|
Loading…
Reference in New Issue
Block a user