diff options
author | Struan Donald <struan@exo.org.uk> | 2013-06-27 15:56:24 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2013-06-28 09:44:03 +0100 |
commit | 2bf5b5a58865becde0e1741e18bb4bcb700aaa2a (patch) | |
tree | 859c6a7469684787380134099a7e66c51a0676da | |
parent | bc2c1a0e3c0e37cb6ea1b502828b48f36706505c (diff) |
make sure we turn map scrolling on and off when when enter and leave map screen.
also refactor all common map screen leaving functions into one place
-rw-r--r-- | www/js/views/around.js | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/www/js/views/around.js b/www/js/views/around.js index 5d06dbf..844a984 100644 --- a/www/js/views/around.js +++ b/www/js/views/around.js @@ -149,6 +149,9 @@ displayButtons: function(isLocationSet) { $('#relocate').show(); + if ( fixmystreet.map ) { + fixmystreet.nav.activate(); + } if (isLocationSet) { $('#cancel').addClass('ui-btn-left').show(); $('#confirm').addClass('ui-btn-right ui-btn-icon-right').show(); @@ -301,9 +304,16 @@ } }, - goPhoto: function(info) { + pauseMap: function() { this.stopListening(FMS.locator); FMS.locator.stopTracking(); + if ( fixmystreet.map ) { + fixmystreet.nav.deactivate(); + } + }, + + goPhoto: function(info) { + this.pauseMap(); this.model.set('lat', info.coordinates.latitude ); this.model.set('lon', info.coordinates.longitude ); this.model.set('categories', info.details.category ); @@ -311,7 +321,6 @@ this.model.set('title_list', info.details.title_list); } FMS.saveCurrentDraft(); - fixmystreet.nav.deactivate(); this.navigate( 'photo' ); }, @@ -329,15 +338,13 @@ goLogin: function(e) { e.preventDefault(); - this.stopListening(FMS.locator); - FMS.locator.stopTracking(); + this.pauseMap(); this.navigate( 'login' ); }, goReports: function(e) { e.preventDefault(); - this.stopListening(FMS.locator); - FMS.locator.stopTracking(); + this.pauseMap(); this.navigate( 'reports' ); }, |