Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Round to 10 minute intervals in timeline, in anim widget and on animate

ZachTRice4102d63412ea
diff --git a/web/index.html b/web/index.html
index 90e330b4a..bb33d573b 100644
--- a/web/index.html
+++ b/web/index.html
@@ -129,13 +129,13 @@ Licensed under the NASA Open Source Agreement, Version 1.3 (http://opensource.gs
</div>
<div id="input-wrapper-minute" class="input-wrapper">
- <div class="date-arrows date-arrow-up" data-interval="minute" data-value="1">
+ <div class="date-arrows date-arrow-up" data-interval="minute" data-value="10">
<svg width="25" height="8">
<path d="M 12.5,0 25,8 0,8 z" class="uparrow"></path>
</svg>
</div>
- <input type="text" size="2" maxlength="2" class="button-input-group" id="minute-input-group" tabindex="6" />
- <div class="date-arrows date-arrow-down" data-interval="minute" data-value="-1">
+ <input type="text" size="2" maxlength="2" step="10" class="button-input-group" id="minute-input-group" tabindex="6" />
+ <div class="date-arrows date-arrow-down" data-interval="minute" data-value="-10">
<svg width="25" height="8">
<path d="M 12.5,0 25,8 0,8 z" class="downarrow"></path>
</svg>
diff --git a/web/js/date/config.js b/web/js/date/config.js
index 0654703cb..10efb479e 100644
--- a/web/js/date/config.js
+++ b/web/js/date/config.js
@@ -557,7 +557,7 @@ export function timelineConfig(models, config, ui) {
case 4: // 10-Minute
labelFormat = d3.time.format.utc('%M');
- dateInterval = d3.time.utc;
+ dateInterval = d3.time.minutes.utc;
// Latest Date minus begin date (Wed Dec 31 1947 19:00:00 GMT-0500 (Eastern Standard Time))
// Subtracting these leaves miliseconds divide by 1000 = seconds
// Divide by 60 = Minutes
@@ -611,13 +611,13 @@ export function timelineConfig(models, config, ui) {
// Calculated next boundary tick by date
tl.zoom.current.ticks.boundary.next = function (current) {
var next = new Date(current);
- return new Date(next.setUTCHours(next.getUTCHours() + 1));
+ return new Date(next.setUTCMinutes(next.getUTCMinutes() + 10));
};
// Calculated next normal tick by date
tl.zoom.current.ticks.normal.next = function (current) {
var next = new Date(current);
- return new Date(next.setUTCMinutes(next.getUTCMinutes() + 60));
+ return new Date(next.setUTCMinutes(next.getUTCMinutes() + 10));
};
// Date of first printed boundary interval of this zoom level
@@ -633,7 +633,7 @@ export function timelineConfig(models, config, ui) {
var first = tl.ticks.normal.firstDate;
return new Date(Date.UTC(first.getUTCFullYear(),
first.getUTCMonth(),
- first.getUTCDate() - 1));
+ first.getUTCDate(), first.getUTCHours(), first.getUTCMinutes() - 1));
};
// Date of last printed boundary interval of this zoom level
@@ -654,7 +654,9 @@ export function timelineConfig(models, config, ui) {
tl.zoom.current.ticks.normal.clickDate = function (d) {
return new Date(d.getUTCFullYear(),
d.getUTCMonth(),
- d.getUTCDate());
+ d.getUTCDate(),
+ d.getUTCHours(),
+ d.getUTCMinutes());
};
// Value for hovered boundary tick
@@ -678,7 +680,9 @@ export function timelineConfig(models, config, ui) {
tl.zoom.current.ticks.boundary.clickDate = function (d) {
return new Date(d.getUTCFullYear(),
d.getUTCMonth(),
- model.selected.getUTCDate());
+ d.getUTCDate(),
+ d.getUTCHours(),
+ model.selected.getUTCMinutes());
};
// When the date updates while dragging the pick forward
@@ -687,7 +691,7 @@ export function timelineConfig(models, config, ui) {
d.getUTCMonth(),
d.getUTCDate(),
d.getUTCHours(),
- d.getUTCMinutes() + 10));
+ d.getUTCMinutes() + 1));
};
// When the date updates while dragging the pick backward
@@ -708,21 +712,20 @@ export function timelineConfig(models, config, ui) {
});
};
- // Setting the week ticks
- // d3.selectAll('.x.axis > g.tick')
- // .each(function () {
- // var currentTick = d3.select(this);
- // var currentTickData = currentTick.data()[0];
- // if ((currentTickData.getUTCDay() === 0) &&
- // (currentTickData.getUTCDate() !== 1)) {
- // currentTick
- // .insert('line', 'rect')
- // .attr('y1', 0)
- // .attr('y2', -10)
- // .attr('x2', 0)
- // .classed('tick-week', true);
- // }
- // });
+ // Setting the hour ticks
+ d3.selectAll('.x.axis > g.tick')
+ .each(function () {
+ var currentTick = d3.select(this);
+ var currentTickData = currentTick.data()[0];
+ if (currentTickData.getUTCMinutes() === 0) {
+ currentTick
+ .insert('line', 'rect')
+ .attr('y1', 0)
+ .attr('y2', -10)
+ .attr('x2', 0)
+ .classed('tick-hour', true);
+ }
+ });
// Update placement of zoom buttons
$('.zoom-btn')
diff --git a/web/js/date/timeline-input.js b/web/js/date/timeline-input.js
index 2af3730a8..e9469f700 100644
--- a/web/js/date/timeline-input.js
+++ b/web/js/date/timeline-input.js
@@ -265,9 +265,10 @@ export function timelineInput(models, config, ui) {
break;
case 'minute-input-group':
if ((newInput >= 0) && (newInput <= 59)) {
- selectedDateObj = new Date(
+ var coeff = 1000 * 60 * 10;
+ selectedDateObj = new Date(Math.round(
(new Date(model.selected))
- .setUTCMinutes(newInput));
+ .setUTCMinutes(newInput) / coeff) * coeff);
}
break;
}
diff --git a/web/js/date/timeline-ticks.js b/web/js/date/timeline-ticks.js
index c8c4ee77d..c2b3fcb80 100644
--- a/web/js/date/timeline-ticks.js
+++ b/web/js/date/timeline-ticks.js
@@ -99,6 +99,22 @@ export function timelineTicks(models, config, ui) {
}
}
}
+ if (tl.config.currentZoom === 4) {
+ if (!$(this)
+ .find('line.tick-hour')
+ .length) {
+ let currentTick = d3.select(this);
+ let currentTickData = currentTick.data()[0];
+ if (currentTickData.getUTCMinutes() === 0) {
+ currentTick
+ .insert('line', 'rect')
+ .attr('y1', 0)
+ .attr('y2', -10)
+ .attr('x2', 0)
+ .classed('tick-hour', true);
+ }
+ }
+ }
});
self.normal.set();