Permalink
Browse files

router.js: hack, force page reload to avoid some maps api problems

  • Loading branch information...
trey0 committed Oct 23, 2012
1 parent 2e9b8bf commit 535b4c9dd7f0106f6f27ca9c61b002b45b5f505d
Showing with 13 additions and 1 deletion.
  1. +13 −1 geocamTiePoint/static/geocamTiePoint/js/backbone/router.js
@@ -28,14 +28,25 @@ $(function($) {
view.render();
},
+ reloadToFixMapIfNeeded: function () {
+ // HACK: force reload to avoid problems the second time we
+ // render a map in the same tab
+ this.numMapViews++;
+ if (this.numMapViews > 1) {
+ location.reload();
+ }
+ },
+
viewOverlay: function(overlay_id) {
console.log('Routed to viewOverlay for ' + overlay_id);
+ this.reloadToFixMapIfNeeded();
var view = new app.views.MapView({id: overlay_id, readonly: true});
view.render();
},
editOverlay: function(overlay_id) {
console.log('Routed to editOverlay for ' + overlay_id);
+ this.reloadToFixMapIfNeeded();
var view = new app.views.SplitOverlayView({id: overlay_id});
view.render();
},
@@ -59,14 +70,15 @@ $(function($) {
},
start: function() {
+ this.numMapViews = 0;
Backbone.history.start();
}
});
app.router = new AppRouter();
//app.router.start();
- /*
+ /*
* Support for undo/redo global functions
*/
window.getState = function() {

0 comments on commit 535b4c9

Please sign in to comment.