Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

fix image download bug caused by negative zoom levels #804

Benjamin Kingb8a477e1b874
diff --git a/web/js/animation/gif.js b/web/js/animation/gif.js
index 74d74c3e8..e5080adf5 100644
--- a/web/js/animation/gif.js
+++ b/web/js/animation/gif.js
@@ -310,17 +310,17 @@ export function animationGif(models, config, ui) {
*/
var calcRes = function(mode) { // return either multiplier or string resolution
// geographic has 10 zoom levels from 0 to 9, polar projections have 8 from 0 to 7
+ var str;
+ var res;
var isGeographic = models.proj.selected.id === 'geographic';
-
// Map the zoom level from 0-9 / 0-7 to an index from 0-4
var zoomRes = [40, 20, 4, 2, 1];
- var str;
- var res;
-
+ var zoom = ui.map.selected.getView().getZoom();
+ zoom = zoom < 0 ? 0 : zoom;
if (isGeographic) {
- res = zoomRes[Math.floor(ui.map.selected.getView().getZoom() / 2)];
+ res = zoomRes[Math.floor(zoom / 2)];
} else {
- res = zoomRes[Math.floor(((ui.map.selected.getView().getZoom() + 2) / 2))];
+ res = zoomRes[Math.floor(((zoom + 2) / 2))];
}
if (mode === 0) { return res.toString(); } else {
diff --git a/web/js/image/panel.js b/web/js/image/panel.js
index 87f7ff820..65591995e 100644
--- a/web/js/image/panel.js
+++ b/web/js/image/panel.js
@@ -186,7 +186,7 @@ export function imagePanel (models, ui, config, dialogConfig) {
// for incremental zoom steps
var curZoom = Math.round(ui.map.selected.getView()
.getZoom());
-
+ curZoom = curZoom < 0 ? 0 : curZoom;
// Don't do anything if the user hasn't changed zoom levels; we want to
// preserve their existing settings
if (curZoom !== lastZoom) {