Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

WV-2229: Fixing animation issues (#3950)

Ryan Weiler8fa99062a010
diff --git a/package-lock.json b/package-lock.json
index 9bb26337d..f3b62ecb2 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -5087,13 +5087,13 @@
"dev": true,
"hasInstallScript": true,
"dependencies": {
- "@testim/chrome-version": "^1.1.2",
- "axios": "^0.27.2",
- "del": "^6.0.0",
- "extract-zip": "^2.0.1",
- "https-proxy-agent": "^5.0.0",
- "proxy-from-env": "^1.1.0",
- "tcp-port-used": "^1.0.1"
+ "@testim/chrome-version": "^1.1.2",
+ "axios": "^0.27.2",
+ "del": "^6.0.0",
+ "extract-zip": "^2.0.1",
+ "https-proxy-agent": "^5.0.0",
+ "proxy-from-env": "^1.1.0",
+ "tcp-port-used": "^1.0.1"
},
"bin": {
"chromedriver": "bin/chromedriver"
diff --git a/web/js/components/animation-widget/play-queue.js b/web/js/components/animation-widget/play-queue.js
index c3b769cc3..5f56cf704 100644
--- a/web/js/components/animation-widget/play-queue.js
+++ b/web/js/components/animation-widget/play-queue.js
@@ -93,9 +93,10 @@ class PlayQueue extends React.Component {
* Determines whether to start at current date or the selected start date
*/
getStartDate() {
- const { endDate, startDate, snappedCurrentDate } = this.props;
+ const { startDate, endDate, snappedCurrentDate } = this.props;
const nextDate = this.nextDate(snappedCurrentDate);
- if (snappedCurrentDate > startDate && nextDate < endDate) {
+ const nextDateAfterSnapped = this.nextDate(nextDate);
+ if (snappedCurrentDate > startDate && nextDate < endDate && nextDateAfterSnapped < endDate) {
return toString(nextDate);
}
return toString(startDate);
diff --git a/web/js/modules/animation/util.js b/web/js/modules/animation/util.js
index 0725ba951..96c7e2f90 100644
--- a/web/js/modules/animation/util.js
+++ b/web/js/modules/animation/util.js
@@ -39,9 +39,19 @@ export function snapToIntervalDelta(currDate, startDate, endDate, interval, delt
export function getNumberOfSteps(start, end, interval, delta = 1, maxToCheck) {
let i = 1;
let currentDate = start;
+ let nextDate = util.dateAdd(start, interval, delta);
+ if (nextDate > end) {
+ i = 1;
+ return i;
+ }
while (currentDate < end) {
i += 1;
currentDate = util.dateAdd(currentDate, interval, delta);
+ nextDate = util.dateAdd(currentDate, interval, delta);
+ // checking to see if next date is after end date to prevent creation of extra frame
+ if (nextDate > end) {
+ return i;
+ }
// if checking for a max number limit, break out after reaching it
if (maxToCheck && i >= maxToCheck) {
return i;