Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Show and hide 10-Minute interval option in animation widget - Added 10-Minute option to animation increment picker - Created maxZoom model and event that triggers setMaxZoomlevel which counts the number of zoom levels based on the active layers - Added setMaxZoomlevel update to toggleSubdaily - Triggered animation update after setMaxZoomlevel within toggleSubdaily

ZachTRiced3d9bc615d96
diff --git a/web/js/animation/widget.js b/web/js/animation/widget.js
index 125b7608f..02e7f1081 100644
--- a/web/js/animation/widget.js
+++ b/web/js/animation/widget.js
@@ -7,7 +7,7 @@ import lodashIndexOf from 'lodash/indexOf';
import util from '../util/util';
export function animationWidget (models, config, ui) {
- var zooms = ['yearly', 'monthly', 'daily'];
+ var zooms = ['yearly', 'monthly', 'daily', '10-Minute'];
var self = {};
var timeline = ui.timeline;
var model = models.anim;
@@ -153,6 +153,11 @@ export function animationWidget (models, config, ui) {
*
*/
self.getIncrements = function () {
+ if (models.date.maxZoom > 3) {
+ zooms = ['yearly', 'monthly', 'daily', '10-Minute'];
+ } else {
+ zooms = ['yearly', 'monthly', 'daily'];
+ }
return zooms[timeline.config.currentZoom - 1];
};
diff --git a/web/js/date/model.js b/web/js/date/model.js
index 5ac8b85fd..0faa66814 100644
--- a/web/js/date/model.js
+++ b/web/js/date/model.js
@@ -71,6 +71,8 @@ export function dateModel(config, spec) {
return util.today();
};
+ self.maxZoom = null;
+
self.save = function (state) {
state.t = self.selected.toISOString()
.split('T')[0] + '-' + 'T' + self.selected.toISOString()
diff --git a/web/js/layers/active.js b/web/js/layers/active.js
index 0b0d18834..9aca069f3 100644
--- a/web/js/layers/active.js
+++ b/web/js/layers/active.js
@@ -30,7 +30,8 @@ export function layersActive(models, ui, config) {
.on('remove', onLayerRemoved)
.on('update', onLayerUpdate)
.on('visibility', onLayerVisibility)
- .on('toggle-subdaily', toggleSubdaily);
+ .on('toggle-subdaily', toggleSubdaily)
+ .on('set-zoom', setMaxZoomlevel);
models.proj.events
.on('select', onProjectionChanged);
models.palettes.events
@@ -422,18 +423,26 @@ export function layersActive(models, ui, config) {
}
};
+ var setMaxZoomlevel = function (zoomLevel) {
+ models.date.maxZoom = zoomLevel;
+ };
+
var toggleSubdaily = function () {
if (subdailyCheck()) {
document.getElementById('zoom-minutes').style.display = null;
document.getElementById('input-wrapper-hour').style.display = null;
document.getElementById('input-wrapper-minute').style.display = null;
document.getElementById('timeline-header').classList.add('subdaily');
+ setMaxZoomlevel(4);
+ models.anim.events.trigger('change');
} else {
document.getElementById('zoom-minutes').style.display = 'none';
document.getElementById('input-wrapper-hour').style.display = 'none';
document.getElementById('input-wrapper-minute').style.display = 'none';
document.getElementById('timeline-header').classList.remove('subdaily');
document.getElementById('zoom-days').click(); // Switch back to 'Days' view
+ setMaxZoomlevel(3);
+ models.anim.events.trigger('change');
}
};