Interactive interface for browsing global, full-resolution satellite imagery
Added rotation buttons
Edmond Lee7089a26c8a05
diff --git a/web/css/wv.map.css b/web/css/wv.map.cssindex c5bb7cdcf..f89292771 100644--- a/web/css/wv.map.css+++ b/web/css/wv.map.css@@ -60,6 +60,18 @@border-radius:10px;}+.wv-map-rotate-left {+ top: 250px;+ border-top-left-radius:10px;+ border-top-right-radius:10px;+}++.wv-map-rotate-right {+ top: 300px;+ border-bottom-left-radius:10px;+ border-bottom-right-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.jsindex c246d4ed9..5a04065cf 100644--- a/web/js/map/wv.map.ui.js+++ b/web/js/map/wv.map.ui.js@@ -473,6 +473,7 @@ wv.map.ui = wv.map.ui || function(models, config) {//allow rotation by dragging for polar projectionsif(proj.id !== 'geographic') {createResetButton(map);+ createRotationWidget(map);map.addInteraction(rotateInteraction);map.addInteraction(mobileRotation);}@@ -641,6 +642,49 @@ wv.map.ui = wv.map.ui || function(models, config) {});};+ //Create rotation buttons for polar views+ var createRotationWidget = function(map) {+ var $map = $("#" + map.getTarget());++ var $left = $("<button></button>")+ .addClass("wv-map-rotate-left wv-map-zoom"),+ $lefticon = $("<i></i>")+ .addClass("fa fa-repeat");++ var $right = $("<button></button>")+ .addClass("wv-map-rotate-right wv-map-zoom"),+ $righticon = $("<i></i>")+ .addClass("fa fa-undo");++ $left.append($lefticon); $right.append($righticon);+ $map.append($left).append($right);++ //Set buttons to animate rotation by 18 degrees+ $left.button({+ text: false+ }).click(function() {+ map.beforeRender(ol.animation.rotate({+ duration: 500,+ rotation: map.getView().getRotation()+ }));++ map.getView().rotate(map.getView().getRotation() + (Math.PI / 10));+ });++ $right.button({+ text: false+ }).click(function() {+ map.beforeRender(ol.animation.rotate({+ duration: 500,+ rotation: map.getView().getRotation()+ }));++ map.getView().rotate(map.getView().getRotation() - (Math.PI / 10));+ });+++ };+var zoomAction = function(map, amount) {return function() {var zoom = map.getView().getZoom();