Interactive interface for browsing global, full-resolution satellite imagery
Extent permalinks
Mike McGann5244e7aa3638
diff --git a/web/js/map/wv.map.model.js b/web/js/map/wv.map.model.jsindex 1c528e38e..84b95fb30 100644--- a/web/js/map/wv.map.model.js+++ b/web/js/map/wv.map.model.js@@ -32,6 +32,7 @@ wv.map.model = wv.map.model || function(models, config) {var extent = state.v;var maxExtent = proj.maxExtent;if ( ol.extent.intersects(extent, maxExtent) ) {+ console.log("loading extent", state.v);self.extent = state.v;} else {self.extent = _.clone(proj.maxExtent);diff --git a/web/js/map/wv.map.ui.js b/web/js/map/wv.map.ui.jsindex f5164af0b..dcd4f46ef 100644--- a/web/js/map/wv.map.ui.js+++ b/web/js/map/wv.map.ui.js@@ -32,7 +32,9 @@ wv.map.ui = wv.map.ui || function(models, config) {self.proj[proj.id] = map;});- models.proj.events.on("select", updateProjection);+ models.proj.events.on("select", function() {+ updateProjection();+ });models.layers.events.on("add", addLayer).on("remove", removeLayer)@@ -59,14 +61,24 @@ wv.map.ui = wv.map.ui || function(models, config) {// using the previous value.showMap(map);map.updateSize();- if ( start && models.proj.selected.id === "geographic" &&- !models.map.extent ) {- var extent = models.map.getLeadingExtent();- map.getView().fitExtent(extent, map.getSize());- }+if ( self.selected.previousCenter ) {self.selected.setCenter(self.selected.previousCenter);}++ // This is awkward and needs a refactoring+ if ( start ) {+ var projId = models.proj.selected.id;+ var extent = null;+ if ( models.map.extent ) {+ extent = models.map.extent;+ } else if ( !models.map.extent && projId === "geographic" ) {+ extent = models.map.getLeadingExtent();+ }+ if ( extent ) {+ map.getView().fitExtent(extent, map.getSize());+ }+ }updateExtent();};@@ -362,6 +374,10 @@ wv.map.ui = wv.map.ui || function(models, config) {]});createZoomButtons(map, proj);++ map.getView().on("change:center", updateExtent);+ map.getView().on("change:resolution", updateExtent);+return map;};