Interactive interface for browsing global, full-resolution satellite imagery
Fix timeline minute zoom when using showSubdaily param
ZachTRiceea2aff15c6aa
diff --git a/web/js/date/config.js b/web/js/date/config.jsindex ff5dc6fe9..a391d5011 100644--- a/web/js/date/config.js+++ b/web/js/date/config.js@@ -1087,6 +1087,7 @@ export function timelineConfig(models, config, ui) {var switchZoom = function(zoomLevel) {var clone;var zoomElement;+ model.events.trigger('update-timewheel');switch (zoomLevel) {case 1:zoomElement = '#zoom-years';diff --git a/web/js/date/timeline-input.js b/web/js/date/timeline-input.jsindex a82b3a50a..97a4bf35d 100644--- a/web/js/date/timeline-input.js+++ b/web/js/date/timeline-input.js@@ -149,7 +149,7 @@ export function timelineInput(models, config, ui) {var max = model.maxDate();var date = model[model.activeDate];var maxZoom = model.maxZoom;- if (config.parameters.showSubdaily) {+ if (model.maxZoom >= 4 || config.parameters.showSubdaily) {document.getElementById('timeline-header').classList.add('subdaily');maxZoom = 4;}@@ -245,9 +245,9 @@ export function timelineInput(models, config, ui) {var endDate = models.layers.lastDate();// Disable arrows if nothing before/after selection- if (model.selectedZoom === 4 && ms >= endDate) {+ if (model.selectedZoom > 3 && ms >= endDate) {$incrementBtn.addClass('button-disabled');- } else if (model.selectedZoom !== 4 && nd > endDate) {+ } else if (model.selectedZoom < 4 && nd > endDate) {$incrementBtn.addClass('button-disabled');} else {$incrementBtn.removeClass('button-disabled');diff --git a/web/js/layers/active.js b/web/js/layers/active.jsindex d4029a3cf..e3a3891c9 100644--- a/web/js/layers/active.js+++ b/web/js/layers/active.js@@ -20,7 +20,7 @@ export function layersActive(models, ui, config) {var currentProjection = models.proj.selected.id;var check;- if (config.parameters.showSubdaily) {+ if (model.maxZoom >= 4 || config.parameters.showSubdaily) {check = true;} else {lodashEach(activeLayers, function(activeLayer) {diff --git a/web/js/map/layerbuilder.js b/web/js/map/layerbuilder.jsindex de8e1e221..f42503dfe 100644--- a/web/js/map/layerbuilder.js+++ b/web/js/map/layerbuilder.js@@ -127,7 +127,7 @@ export function mapLayerBuilder(models, config, cache, mapUi) {date = models.date[models.date.activeDate];// If this not a subdaily layer, truncate the selected time to// UTC midnight- if (def.period !== 'subdaily') {+ if (models.layers.maxZoom < 4) {date = util.clearTimeUTC(date);}}diff --git a/web/js/util/util.js b/web/js/util/util.jsindex d38612575..9e67dd574 100644--- a/web/js/util/util.js+++ b/web/js/util/util.js@@ -591,6 +591,7 @@ export default (function (self) {var range = self.rollRange(date, interval, minDate, maxDate);var min = range.first;var max = range.last;+ var second = date.getUTCSeconds();var minute = date.getUTCMinutes();var hour = date.getUTCHours();var day = date.getUTCDate();@@ -623,7 +624,7 @@ export default (function (self) {if (day > daysInMonth) {day = daysInMonth;}- var newDate = new Date(Date.UTC(year, month, day, hour, minute));+ var newDate = new Date(Date.UTC(year, month, day, hour, minute, second));newDate = new Date(self.clamp(newDate, minDate, maxDate));return newDate;};