Interactive interface for browsing global, full-resolution satellite imagery
zero out times conditionally based on date zoom level, add zero functionality, remove range select zero
Ed Platoa40f918bda87
diff --git a/web/js/animation/ui.js b/web/js/animation/ui.jsindex d66c14a77..1aa31189a 100644--- a/web/js/animation/ui.js+++ b/web/js/animation/ui.js@@ -106,6 +106,8 @@ export function animationUi(models, ui) {**/self.getStartDate = function () {+ // get index+1 of date zoom 'yearly', 'monthly', 'daily', '10-Minute'+ let dateSelectedZoom = models.date.selectedZoom || 0;var state;var endDate;var startDate;@@ -113,6 +115,13 @@ export function animationUi(models, ui) {state = animModel.rangeState;endDate = util.parseDateUTC(state.endDate);startDate = util.parseDateUTC(state.startDate);+ // if not index+1 of 4 ('10-Minute'), zero out start/end times and resave+ if (dateSelectedZoom < 4) {+ let zeroDate = dateModel.selected;+ util.clearTimeUTC(zeroDate);+ util.clearTimeUTC(startDate);+ dateModel.selected = zeroDate;+ }currentDate = dateModel.selected;if (currentDate > startDate && self.nextDate(currentDate) < endDate) {return util.toISOStringSeconds(self.nextDate(currentDate));diff --git a/web/js/animation/widget.js b/web/js/animation/widget.jsindex 0bfbe3da4..a8c70a213 100644--- a/web/js/animation/widget.js+++ b/web/js/animation/widget.js@@ -273,6 +273,11 @@ export function animationWidget (models, config, ui) {**/self.onPressPlay = function () {+ let zoomLevel = ui.anim.ui.getInterval();+ if (zoomLevel !== 'minute') {+ // zero out start/end date times+ self.setZeroDateTimes();+ }model.rangeState.playing = true;model.events.trigger('play');};@@ -373,9 +378,42 @@ export function animationWidget (models, config, ui) {**/self.onPressGIF = function () {+ let zoomLevel = ui.anim.ui.getInterval();+ if (zoomLevel !== 'minute') {+ // zero out start/end date times+ self.setZeroDateTimes();+ }model.events.trigger('gif-click');};+ /*+ * Zero out hours/min/sec for start/end dates+ * will snap draggers into place on timeline+ * and zero out GIF Animation preview modal and url time data+ *+ * used with onPressPlay and onPressGIF+ *+ * @method setZeroDateTimes+ *+ * @static+ *+ * @returns {void}+ *+ */+ self.setZeroDateTimes = function () {+ let state = model.rangeState;+ let startDate = util.parseDateUTC(state.startDate);+ let endDate = util.parseDateUTC(state.endDate);++ util.clearTimeUTC(startDate);+ util.clearTimeUTC(endDate);++ // save changes to model+ model.rangeState.startDate = util.toISOStringSeconds(startDate);+ model.rangeState.endDate = util.toISOStringSeconds(endDate);+ model.events.trigger('change');+ };+self.init();return self;};