diff options
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"); |