Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

fix permalink in polar views #235

Benjaminea0a39f16b0e
diff --git a/web/js/map/wv.map.model.js b/web/js/map/wv.map.model.js
index 1eda34d7a..7c35b0f2b 100644
--- a/web/js/map/wv.map.model.js
+++ b/web/js/map/wv.map.model.js
@@ -23,6 +23,7 @@ wv.map.model = wv.map.model || function(models, config) {
self.extent = null;
self.events = wv.util.events();
+ self.rotation = 0;
/*
* Emits update event
*
@@ -55,6 +56,7 @@ wv.map.model = wv.map.model || function(models, config) {
var proj = models.proj.selected;
var extent = state.v;
var maxExtent = proj.maxExtent;
+
if(proj.id === "geographic") {
proj.wrapExtent = maxExtent = [-250, -90, 250, 90];
}
diff --git a/web/js/map/wv.map.rotate.js b/web/js/map/wv.map.rotate.js
index 41f231d75..1a382ee1b 100644
--- a/web/js/map/wv.map.rotate.js
+++ b/web/js/map/wv.map.rotate.js
@@ -137,15 +137,16 @@ wv.map.rotate = wv.map.rotate || function(ui, models, map) {
*/
this.updateRotation = function() {
var deg, radians, view;
+
view = ui.selected.getView();
radians = view.getRotation();
- deg = radians * (180.0 / Math.PI);
models.map.rotation = radians;
- self.setResetButton(deg);
- model.update();
+ self.setResetButton(radians);
+ model.update(view.get);
};
+
/*
* examines the number of characters present in the
* reset button and reassigns padding accordingly
@@ -157,8 +158,9 @@ wv.map.rotate = wv.map.rotate || function(ui, models, map) {
*
* @returns {void}
*/
- this.setResetButton = function(deg) {
+ this.setResetButton = function(radians) {
var button = $(".wv-map-reset-rotation");
+ var deg = radians * (180.0 / Math.PI);
//Set reset button content
button.button("option", "label", Number(deg).toFixed());
switch (true) {
diff --git a/web/js/map/wv.map.ui.js b/web/js/map/wv.map.ui.js
index 5f0a913d3..4c3cbf39f 100644
--- a/web/js/map/wv.map.ui.js
+++ b/web/js/map/wv.map.ui.js
@@ -103,7 +103,7 @@ wv.map.ui = wv.map.ui || function(models, config, components) {
//Update the rotation buttons if polar projection to display correct value
if(models.proj.selected.id !== "geographic")
- rotation.updateRotation();
+ rotation.setResetButton(models.map.rotation);
// If the browser was resized, the inactive map was not notified of
// the event. Force the update no matter what and reposition the center
@@ -125,7 +125,7 @@ wv.map.ui = wv.map.ui || function(models, config, components) {
extent = models.map.getLeadingExtent();
}
if ( extent ) {
- map.getView().fit(extent, map.getSize());
+ map.getView().fit(extent);
}
}
updateExtent();
@@ -506,7 +506,7 @@ wv.map.ui = wv.map.ui || function(models, config, components) {
*/
var createMap = function(proj) {
var id, $map, scaleMetric, scaleImperial, rotateInteraction,
- map, mobileRotation, lineSvgs;
+ map, mobileRotation, lineSvgs, resolution;
id = "wv-map-" + proj.id;
$map = $("<div></div>")
@@ -590,7 +590,7 @@ wv.map.ui = wv.map.ui || function(models, config, components) {
// Set event listeners for changes on the map view (when rotated, zoomed, panned)
map.getView().on("change:center", updateExtent);
map.getView().on("change:resolution", updateExtent);
- map.getView().on("change:rotation", _.throttle(rotation.updateRotation, 300));
+ map.getView().on("change:rotation", _.throttle(onRotate, 300));
map.on('pointerdrag', function() {
self.mapIsbeingDragged = true;
self.events.trigger('drag');
@@ -687,7 +687,10 @@ wv.map.ui = wv.map.ui || function(models, config, components) {
});
onZoomChange();
};
-
+ var onRotate = function() {
+ rotation.updateRotation();
+ updateExtent();
+ };
/*
* Creates map events based on mouse position
*