diff options
author | etienne <etienne@9215b0d5-fb2c-4bbd-8d3e-bd2e9090e864> | 2009-01-18 13:21:11 +0000 |
---|---|---|
committer | etienne <etienne@9215b0d5-fb2c-4bbd-8d3e-bd2e9090e864> | 2009-01-18 13:21:11 +0000 |
commit | 463993f6bfd47dd5e4b8c750e45b9e72912e3abb (patch) | |
tree | 47ec70dd42c5f98084332ccabd109139cc3735db | |
parent | ae0b72b845ac0100aa3f42095f1f31631f787752 (diff) | |
download | Chimère-463993f6bfd47dd5e4b8c750e45b9e72912e3abb.tar.bz2 Chimère-463993f6bfd47dd5e4b8c750e45b9e72912e3abb.zip |
Zoom to the modified feature in administration
git-svn-id: http://www.peacefrogs.net/svn/chimere/trunk@19 9215b0d5-fb2c-4bbd-8d3e-bd2e9090e864
-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) { |