Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Rotation now restricted to polar views. Alt key must be pressed

Edmond Leeb3dfc0759a85
diff --git a/web/js/map/wv.map.ui.js b/web/js/map/wv.map.ui.js
index fcf40f398..2a64a99c5 100644
--- a/web/js/map/wv.map.ui.js
+++ b/web/js/map/wv.map.ui.js
@@ -409,6 +409,7 @@ wv.map.ui = wv.map.ui || function(models, config) {
.hide();
$(selector).append($map);
+ //Create two specific controls
var scaleMetric = new ol.control.ScaleLine({
className: "wv-map-scale-metric",
units: "metric"
@@ -418,6 +419,14 @@ wv.map.ui = wv.map.ui || function(models, config) {
units: "imperial"
});
+ //insert this to polar map views for desktop and mobile rotation
+ var rotateInteraction = new ol.interaction.DragRotate({
+ condition: ol.events.condition.altKeyOnly,
+ duration: animationDuration
+ }), mobileRotation = new ol.interaction.PinchRotate({
+ duration: animationDuration
+ });
+
var map = new ol.Map({
view: new ol.View({
maxResolution: proj.resolutions[0],
@@ -450,12 +459,6 @@ wv.map.ui = wv.map.ui || function(models, config) {
}),
new ol.interaction.DragZoom({
duration: animationDuration
- }),
- new ol.interaction.PinchRotate({
- duration: animationDuration
- }),
- new ol.interaction.DragRotate({
- duration: animationDuration
})
]
});
@@ -467,6 +470,12 @@ wv.map.ui = wv.map.ui || function(models, config) {
createZoomButtons(map, proj);
createMousePosSel(map, proj);
+ //allow rotation by dragging for polar projections
+ if(proj.id !== 'geographic') {
+ map.addInteraction(rotateInteraction);
+ map.addInteraction(mobileRotation);
+ }
+
map.getView().on("change:center", updateExtent);
map.getView().on("change:resolution", updateExtent);