Skip to content

Commit

Permalink
Merge pull request #805 from nasa-gibs/gif-too-many-days-hotfix
Browse files Browse the repository at this point in the history
Gif too many days hotfix
  • Loading branch information
Benjaki2 authored Mar 21, 2018
2 parents bb5ce5d + 2923aae commit 2d6e22d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "worldview",
"version": "2.2.3",
"version": "2.2.4",
"description": "Interactive interface for browsing full-resolution, global satellite imagery",
"keywords": [
"NASA",
Expand Down
12 changes: 6 additions & 6 deletions web/js/animation/gif.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion web/js/image/panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 0 additions & 2 deletions web/js/util/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,7 @@ export default (function (self) {
var i = 1;
var currentDate = start;
while (currentDate < end) {
if (i > 1000) throw new Error('Too many days selected');
i++;

currentDate = self.dateAdd(currentDate, interval, 1);
}
return i;
Expand Down

0 comments on commit 2d6e22d

Please sign in to comment.