diff options
author | Struan Donald <struan@exo.org.uk> | 2013-03-20 16:46:42 +0000 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2013-03-21 17:19:40 +0000 |
commit | 73c76ce0aa20f32769a36e08a82e62bd63d6e9f5 (patch) | |
tree | aa24bb18d9b141c961f38954b62f1bb7dca0186f /www/js/views/around.js | |
parent | 7c28392bc868e2f7c978aee50eea641a62a3b21b (diff) |
simple address search functionality
Diffstat (limited to 'www/js/views/around.js')
-rw-r--r-- | www/js/views/around.js | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/www/js/views/around.js b/www/js/views/around.js index 8720ccc..49b65da 100644 --- a/www/js/views/around.js +++ b/www/js/views/around.js @@ -7,12 +7,20 @@ events: { 'pagehide': 'destroy', 'pageshow': 'afterDisplay', + 'click #search': 'goSearch', 'click #relocate': 'centerMapOnPosition', 'click #mark-here': 'onClickReport' }, afterDisplay: function() { - this.locate(); + if ( FMS.currentLocation ) { + var info = { coordinates: FMS.currentLocation }; + FMS.currentLocation = null; + FMS.locator.on('gps_current_position', this.positionUpdate, this); + this.showMap(info); + } else { + this.locate(); + } }, locate: function() { @@ -150,6 +158,16 @@ this.navigate( 'photo' ); }, + goSearch: function(e) { + e.preventDefault(); + FMS.locator.off('gps_located'); + FMS.locator.off('gps_failed'); + FMS.locator.off('gps_locating'); + FMS.locator.off('gps_current_position'); + FMS.locator.stopUpdating(); + this.navigate( 'search' ); + }, + getCrossHairPosition: function() { var cross = fixmystreet.map.getControlsByClass( "OpenLayers.Control.Crosshairs"); |