Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

WV-1356: Disabled smooth zooming on Firefox

Mike McGann313f30de9a2e
diff --git a/web/js/map/wv.map.ui.js b/web/js/map/wv.map.ui.js
index 9ab54327f..eb52219e8 100644
--- a/web/js/map/wv.map.ui.js
+++ b/web/js/map/wv.map.ui.js
@@ -17,6 +17,7 @@ wv.map.ui = wv.map.ui || function(models, config) {
var id = "wv-map";
var selector = "#" + id;
var cache = new Cache(100); // Save layers from days visited
+ var animationDuration = 250;
var self = {};
self.proj = {}; // One map for each projection
@@ -27,6 +28,11 @@ wv.map.ui = wv.map.ui || function(models, config) {
if ( config.parameters.mockMap ) {
return;
}
+
+ if ( wv.util.browser.firefox ) {
+ animationDuration = 0;
+ }
+
// NOTE: iOS sometimes bombs if this is _.each instead. In that case,
// it is possible that config.projections somehow becomes array-like.
_.forOwn(config.projections, function(proj) {
@@ -426,19 +432,19 @@ wv.map.ui = wv.map.ui || function(models, config) {
],
interactions: [
new ol.interaction.DoubleClickZoom({
- duration: 0
+ duration: animationDuration
}),
new ol.interaction.DragPan({
kinetic: new ol.Kinetic(-0.005, 0.05, 100)
}),
new ol.interaction.PinchZoom({
- duration: 0
+ duration: animationDuration
}),
new ol.interaction.MouseWheelZoom({
- duration: 0
+ duration: animationDuration
}),
new ol.interaction.DragZoom({
- duration: 0
+ duration: animationDuration
})
]
});
@@ -511,7 +517,7 @@ wv.map.ui = wv.map.ui || function(models, config) {
var zoom = map.getView().getZoom();
map.beforeRender(ol.animation.zoom({
resolution: map.getView().getResolution(),
- duration: 0
+ duration: animationDuration
}));
map.getView().setZoom(zoom + amount);
};
diff --git a/web/js/util/wv.util.browser.js b/web/js/util/wv.util.browser.js
index 70147aad6..8ec92464e 100644
--- a/web/js/util/wv.util.browser.js
+++ b/web/js/util/wv.util.browser.js
@@ -44,6 +44,8 @@ wv.util.browser = wv.util.browser || (function() {
*/
self.safari = false;
+ self.firefox = false;
+
/**
* Major version number of the browser detected in the user-agent string.
* If the version is not important for Worldview at the moment, this
@@ -105,6 +107,8 @@ wv.util.browser = wv.util.browser || (function() {
} else if ( tests.ie() ) {
self.ie = true;
self.version = tests.ieVersion();
+ } else if ( tests.firefox() ) {
+ self.firefox = true;
}
self.cors = tests.cors();
@@ -164,6 +168,10 @@ wv.util.browser = wv.util.browser || (function() {
return false;
};
+ self.tests.firefox = function() {
+ return navigator.userAgent.toLowerCase().indexOf("firefox") > -1;
+ };
+
self.tests.touchDevice = function() {
var el = document.createElement('div');
el.setAttribute('ontouchstart', 'return;');