Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

move modal to top/bottom of crop area when crop area is too wide to leave room for modal. truncate estimate gif file size to 2 decimal points so long trailing decimals don't mess with modal width

Jason Kentd30934402ee3
diff --git a/web/js/components/animation-widget/gif-panel-grid.js b/web/js/components/animation-widget/gif-panel-grid.js
index d0fa9f38f..112511787 100644
--- a/web/js/components/animation-widget/gif-panel-grid.js
+++ b/web/js/components/animation-widget/gif-panel-grid.js
@@ -9,18 +9,19 @@ import PropTypes from 'prop-types';
*/
export class GifPanelGrid extends React.Component {
renderImageSize() {
- var size = this.props.requestSize;
+ const { requestSize } = this.props;
+ const roundedSize = requestSize.toFixed(2);
if (!this.props.valid) {
return (
<div id="gif-size" className="gif-size gif-size-invalid grid-child">
<i className="fa fa-times fa-fw" />
- <span>{this.props.maxGifSize + ' MB' + '~' + size + ' MB'}</span>
+ <span>{this.props.maxGifSize + ' MB' + '~' + roundedSize + ' MB'}</span>
</div>
);
} else {
return (
<div id="gif-size" className="gif-size grid-child">
- <span>{this.props.maxGifSize + ' MB / ~' + size + ' MB'} </span>
+ <span>{this.props.maxGifSize + ' MB / ~' + roundedSize + ' MB'} </span>
</div>
);
}
diff --git a/web/js/containers/gif.js b/web/js/containers/gif.js
index 3af40571e..89f3c4506 100644
--- a/web/js/containers/gif.js
+++ b/web/js/containers/gif.js
@@ -255,16 +255,25 @@ class GIF extends Component {
}
getModalOffsets(boundaries) {
const { screenWidth, screenHeight } = this.props;
- const { x, y, x2 } = boundaries;
+ const { x, y, x2, y2 } = boundaries;
const width = 342;
const height = 280;
- let left = x2 + 20;
- let top = y - 20;
- if (left + width > screenWidth && x - 20 - width > 0) {
- left = x - 20 - width;
+ const padding = 20;
+ let left = x2 + padding;
+ let top = y - padding;
+ if (left + width > screenWidth && x - padding - width > 0) {
+ left = x - padding - width;
+ }
+ if (left + width > screenWidth && x - padding - width < 0) {
+ left = left - width - padding;
+ if (y < height) {
+ top = y2;
+ } else {
+ top = y - padding - height;
+ }
}
if (top + height > screenHeight) {
- top = screenHeight - 20 - height;
+ top = screenHeight - padding - height;
}
return {
offsetLeft: left,