Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Added a reset rotation button

Edmond Lee5393445e6a05
diff --git a/web/css/wv.map.css b/web/css/wv.map.css
index 86297f4c6..c5bb7cdcf 100644
--- a/web/css/wv.map.css
+++ b/web/css/wv.map.css
@@ -55,6 +55,11 @@
border-bottom-right-radius:10px;
}
+.wv-map-reset-rotation { /* Place reset button above zoom buttons */
+ top: 70px;
+ border-radius:10px;
+}
+
.wv-map-scale-imperial {
position: absolute;
right: 10px;
diff --git a/web/js/map/wv.map.ui.js b/web/js/map/wv.map.ui.js
index 2a64a99c5..c246d4ed9 100644
--- a/web/js/map/wv.map.ui.js
+++ b/web/js/map/wv.map.ui.js
@@ -472,6 +472,7 @@ wv.map.ui = wv.map.ui || function(models, config) {
//allow rotation by dragging for polar projections
if(proj.id !== 'geographic') {
+ createResetButton(map);
map.addInteraction(rotateInteraction);
map.addInteraction(mobileRotation);
}
@@ -482,6 +483,31 @@ wv.map.ui = wv.map.ui || function(models, config) {
return map;
};
+ //Create a button to reset rotation
+ var createResetButton = function(map) {
+ var $map = $("#" + map.getTarget());
+ var $outIcon = $("<i></i>")
+ .addClass("fa")
+ .addClass("fa-minus")
+ .addClass("fa-1x");
+ var $button = $("<button></button>")
+ .addClass("wv-map-zoom")
+ .addClass("wv-map-reset-rotation")
+ .append($outIcon);
+
+ $map.append($button);
+ $button.button({
+ label: "Reset rotation"
+ })
+ .click(function(event) { //create a rotation to rotate it back to zero degrees
+ map.beforeRender(ol.animation.rotate({
+ duration: 500,
+ rotation: map.getView().getRotation()
+ }));
+ map.getView().rotate(0);
+ });
+ };
+
var createZoomButtons = function(map, proj) {
var $map = $("#" + map.getTarget());