Interactive interface for browsing global, full-resolution satellite imagery
fixed event-errors associated with ol-migration
Benjaminac5da2aa436a
diff --git a/web/js/map/wv.map.animate.js b/web/js/map/wv.map.animate.jsindex 558e6e453..927928e18 100644--- a/web/js/map/wv.map.animate.js+++ b/web/js/map/wv.map.animate.js@@ -38,69 +38,67 @@ wv.map.animate = wv.map.animate || function(models, config, ui) {* @returns {void}*/self.move = function(method, location, zoomLevel, callback) {-- var start = lastLocation || map.getView().getCenter();+ var start, currentZoom, newZoom, duration, wait, startTime, pan, bounceZoom, bounce, view, zoomTo;++ start = lastLocation || map.getView().getCenter();//Determine zoom and pan levels depending on distance to new point//var distance = ol.sphere.ESPG4326.haversineDistance(start, location);- var currentZoom = map.getView().getZoom();- var newZoom = zoomLevel || 5;+ currentZoom = map.getView().getZoom();+ newZoom = zoomLevel || 5;- var duration = ( method == "fly" ) ? 5000 : 1000;- var wait = ( method == "fly" ) ? 1000 : 1;+ duration = ( method == "fly" ) ? 5000 : 1000;+ wait = ( method == "fly" ) ? 1000 : 1;- var startTime = +new Date();- var pan = ol.animation.pan({- duration: duration,- source: map.getView().getCenter(),- start: startTime- });+ view = map.getView();+ // pan = view.animate({+ // duration: duration,+ // });// use this to set proper zoom/res// For bounce, if zoom is too high, it bounces "in" insteade of "out";// force it to zoom out by starting at zoom 4- var bounceZoom = (currentZoom >= 8) ? 4 : currentZoom - 3;+ bounceZoom = (currentZoom >= 8) ? 4 : currentZoom - 3;if (bounceZoom < 0) {bounceZoom = 0;}- var bounce = ol.animation.bounce({- duration: duration,- resolution: models.proj.selected.resolutions[bounceZoom],- start: startTime- });- var zoomTo = ol.animation.zoom({- duration: duration,- resolution: models.proj.selected.resolutions[currentZoom],- start: startTime- });- //If the zoom level is far out enough then it should start with a 'zoom'if(currentZoom < 4) {method = 'zoom';}setTimeout(function() {if ( method === "fly" ) {- map.beforeRender(pan, bounce);+ view.animate({+ duration: duration,+ resolution: models.proj.selected.resolutions[bounceZoom],+ },+ {+ duration: duration,+ center: location,+ zoom: newZoom+ });} else if ( method === 'zoom' ) {- map.beforeRender(pan, zoomTo);+ view.animate({+ duration: duration,+ zoom: models.proj.selected.resolutions[currentZoom]+ },+ {+ duration: duration,+ center: location,+ zoom: newZoom+ });} else {- map.beforeRender(pan);+ view.animate({+ duration: duration,+ center: location,+ zoom: newZoom+ });}- if ( location.length == 2 ) {- map.getView()- .setCenter(location);-- map.getView().setZoom(newZoom);- } else {- map.getView().fit(location, map.getSize());- if(map.getView().getZoom() > 8)- map.getView().setZoom(8);- }callback();}, wait);diff --git a/web/js/naturalEvents/wv.naturalEvents.map.js b/web/js/naturalEvents/wv.naturalEvents.map.jsindex 2b2471841..804bb8bf9 100644--- a/web/js/naturalEvents/wv.naturalEvents.map.js+++ b/web/js/naturalEvents/wv.naturalEvents.map.js@@ -21,6 +21,9 @@ wv.naturalEvents.map = wv.naturalEvents.map || function(models, maps, config) {self.current = null;var init = function() {+ if (!map) {+ map = maps.selected;+ }};var getButtonDimensions = function() {@@ -67,9 +70,6 @@ wv.naturalEvents.map = wv.naturalEvents.map || function(models, maps, config) {self.draw = function(location) {//loads current map- if (!map) {- map = maps.selected;- }//remove any existing location firstmap.removeLayer(vectorLayer);