Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

WV-2284: Fix geostationary gifs in FireFox (#3865)

Jason Kentb0c4c8180c3b
diff --git a/web/js/containers/gif.js b/web/js/containers/gif.js
index b6adc769c..becae726f 100644
--- a/web/js/containers/gif.js
+++ b/web/js/containers/gif.js
@@ -47,9 +47,7 @@ class GIF extends Component {
} = this.getModalOffsets(boundaries);
this.state = {
isDownloaded: false,
- isDownloadError: false,
showDates: true,
- isValidSelection: true,
progress: 0,
downloadedObject: {},
offsetLeft,
@@ -93,8 +91,8 @@ class GIF extends Component {
screenHeight,
proj,
onClose,
- endDate,
- startDate,
+ endDateStr,
+ startDateStr,
numberOfFrames,
} = this.props;
const { boundaries, showDates } = this.state;
@@ -134,8 +132,8 @@ class GIF extends Component {
increment={increment}
projId={proj.id}
lonlats={lonlats}
- startDate={startDate}
- endDate={endDate}
+ startDate={startDateStr}
+ endDate={endDateStr}
onClick={this.createGIF}
onCheck={this.toggleShowDates}
numberOfFrames={numberOfFrames}
@@ -167,8 +165,10 @@ class GIF extends Component {
}
createGIF(width, height) {
- const { getImageArray } = this.props;
- const { boundaries } = this.state;
+ const {
+ getImageArray, startDate, endDate, url,
+ } = this.props;
+ const { boundaries, showDates } = this.state;
const dimensions = {
w: boundaries.y2 - boundaries.y,
h: boundaries.x2 - boundaries.x,
@@ -178,7 +178,14 @@ class GIF extends Component {
const stampWidthRatio = 4.889;
const build = (stamp, dateStamp, stampHeight) => {
- const imageArray = getImageArray(this.state, this.props, { width, height });
+ const options = {
+ startDate,
+ endDate,
+ url,
+ boundaries,
+ showDates,
+ };
+ const imageArray = getImageArray(options, { width, height });
if (!imageArray) return; // won't be true if there are too many frames
gifStream.createGIF(
@@ -234,7 +241,6 @@ class GIF extends Component {
onGifComplete(obj, width, height) {
if (obj.error) {
this.setState({
- isDownloadError: true,
isDownloading: false,
progress: 0,
downloadedObject: {},
@@ -322,8 +328,8 @@ class GIF extends Component {
const {
increment,
speed,
- endDate,
- startDate,
+ endDateStr,
+ startDateStr,
screenHeight,
screenWidth,
onClose,
@@ -368,9 +374,9 @@ class GIF extends Component {
<GifResults
speed={speed}
gifObject={downloadedObject}
- startDate={startDate}
+ startDate={startDateStr}
+ endDate={endDateStr}
onClose={onClose}
- endDate={endDate}
increment={increment}
boundaries={boundaries}
screenWidth={screenWidth}
@@ -411,8 +417,10 @@ function mapStateToProps(state) {
boundaries,
proj: proj.selected,
isActive: animation.gifActive,
- startDate: formatDisplayDate(startDate, subdailyLayersActive(state)),
- endDate: formatDisplayDate(endDate, subdailyLayersActive(state)),
+ startDateStr: formatDisplayDate(startDate, subdailyLayersActive(state)),
+ endDateStr: formatDisplayDate(endDate, subdailyLayersActive(state)),
+ startDate,
+ endDate,
increment: `${increment} Between Frames`,
speed,
map,
@@ -425,9 +433,8 @@ function mapStateToProps(state) {
: TIME_SCALE_FROM_NUMBER[interval],
customSelected ? customDelta : 1,
),
- getImageArray: (gifComponentProps, gifComponentState, dimensions) => getImageArray(
- gifComponentProps,
- gifComponentState,
+ getImageArray: (options, dimensions) => getImageArray(
+ options,
dimensions,
state,
),
@@ -446,7 +453,10 @@ export default connect(
GIF.propTypes = {
boundaries: PropTypes.object,
- endDate: PropTypes.string,
+ startDate: PropTypes.object,
+ endDate: PropTypes.object,
+ startDateStr: PropTypes.string,
+ endDateStr: PropTypes.string,
getImageArray: PropTypes.func,
increment: PropTypes.string,
map: PropTypes.object,
@@ -457,5 +467,5 @@ GIF.propTypes = {
screenHeight: PropTypes.number,
screenWidth: PropTypes.number,
speed: PropTypes.number,
- startDate: PropTypes.string,
+ url: PropTypes.string,
};
diff --git a/web/js/modules/animation/selectors.js b/web/js/modules/animation/selectors.js
index cc98175a7..8927b2383 100644
--- a/web/js/modules/animation/selectors.js
+++ b/web/js/modules/animation/selectors.js
@@ -20,16 +20,16 @@ import { formatDisplayDate } from '../date/util';
*
*/
export default function getImageArray(
- gifComponentState,
- gifComponentProps,
+ options,
dimensions,
state,
) {
const {
animation, proj, map, date, locationSearch,
} = state;
- const { startDate, endDate, url } = gifComponentProps;
- const { boundaries, showDates } = gifComponentState;
+ const {
+ boundaries, showDates, startDate, endDate, url,
+ } = options;
const {
customInterval, interval, customDelta, delta, customSelected,
} = date;