diff options
| -rw-r--r-- | main/widgets.py | 3 | ||||
| -rw-r--r-- | static/edit_map.js | 4 | ||||
| -rw-r--r-- | static/edit_route_map.js | 3 |
3 files changed, 8 insertions, 2 deletions
diff --git a/main/widgets.py b/main/widgets.py index a247edc..21dd464 100644 --- a/main/widgets.py +++ b/main/widgets.py @@ -92,8 +92,7 @@ value='%f'/></p> <input type='hidden' name='%s' id='id_%s' value="%s"/> """ % (_("Latitude"), value_y, _("Longitude"), value_x, name, name, val) tpl += """<script type='text/javascript'><!-- -init(); -""" +init();""" if value: tpl += '''var mylonlat = new OpenLayers.LonLat(%f,%f); putMarker(mylonlat.transform(epsg_display_projection, diff --git a/static/edit_map.js b/static/edit_map.js index fa13dbb..4799341 100644 --- a/static/edit_map.js +++ b/static/edit_map.js @@ -50,6 +50,10 @@ var putMarker = function (lonlat){ ' ' + lonlat.lat + ')'; document.getElementById('live_latitude').value = lonlat.lon; document.getElementById('live_longitude').value = lonlat.lat; + /*zoom to the point*/ + var bounds = layerMarkers.getDataExtent(); + if (bounds) map.zoomToExtent(bounds); + return; } /* main initialisation function */ diff --git a/static/edit_route_map.js b/static/edit_route_map.js index f1a466f..ee3f123 100644 --- a/static/edit_route_map.js +++ b/static/edit_route_map.js @@ -59,6 +59,9 @@ function initFeature(json_geometry){ currentFeature.geometry = linestring; vectors.addFeatures([currentFeature]); currentControl = pathModify; + /*zoom to the route*/ + var bounds = vectors.getDataExtent(); + if (bounds) map.zoomToExtent(bounds); } function updateForm(event) { |
