]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index/directions.js
Merge branch 'convert_roundabout_exits' of https://github.com/jguthrie100/openstreetm...
[rails.git] / app / assets / javascripts / index / directions.js
index 14be8b3583b87fd30ebbdb0f0b1578e487a98d54..8a80328cc05c3767813ac7ff3823330001095d9e 100644 (file)
@@ -40,7 +40,8 @@ OSM.Directions = function (map) {
         shadowUrl: OSM.MARKER_SHADOW,
         shadowSize: [41, 41]
       }),
-      draggable: true
+      draggable: true,
+      autoPan: true
     });
 
     endpoint.marker.on('drag dragend', function (e) {
@@ -54,7 +55,7 @@ OSM.Directions = function (map) {
     });
 
     input.on("keydown", function() {
-      input.css("background-color", "#fff");
+      input.removeClass("error");
     });
 
     input.on("change", function (e) {
@@ -68,6 +69,7 @@ OSM.Directions = function (map) {
     endpoint.setValue = function(value, latlng) {
       endpoint.value = value;
       delete endpoint.latlng;
+      input.removeClass("error");
       input.val(value);
 
       if (latlng) {
@@ -90,8 +92,8 @@ OSM.Directions = function (map) {
         endpoint.awaitingGeocode = false;
         endpoint.hasGeocode = true;
         if (json.length === 0) {
+          input.addClass("error");
           alert(I18n.t('javascripts.directions.errors.no_place', {place: endpoint.value}));
-          input.css("background-color", "rgba(255, 0, 0, 0.5)");
           return;
         }