Interactive interface for browsing global, full-resolution satellite imagery
fix crop boxes
Jason Kent3a620409096e
diff --git a/web/js/containers/gif.js b/web/js/containers/gif.jsindex e5f909ab4..2122ccc98 100644--- a/web/js/containers/gif.js+++ b/web/js/containers/gif.js@@ -15,9 +15,7 @@ import {} from '../modules/image-download/constants';import {imageUtilCalculateResolution,- imageUtilGetCoordsFromPixelValues,- getPercentageFromPixel,- getPixelFromPercentage+ imageUtilGetCoordsFromPixelValues} from '../modules/image-download/util';import { Progress, Modal, ModalBody, ModalHeader } from 'reactstrap';import { timeScaleFromNumberKey } from '../modules/date/constants';@@ -134,12 +132,12 @@ class GIF extends Component {/><Crop- x={getPercentageFromPixel(screenWidth, x)}- y={getPercentageFromPixel(screenHeight, y)}+ x={x}+ y={y}+ width={x2 - x}+ height={y2 - y}maxHeight={screenHeight}maxWidth={screenWidth}- width={getPercentageFromPixel(screenWidth, x2 - x)}- height={getPercentageFromPixel(screenHeight, y2 - y)}onChange={lodashDebounce(this.onBoundaryChange, 5)}onClose={onClose}coordinates={{@@ -291,22 +289,20 @@ class GIF extends Component {}onBoundaryChange(cropBounds) {- const {- screenWidth,- screenHeight,- onBoundaryChange- } = this.props;- const x = getPixelFromPercentage(screenWidth, cropBounds.x);- const y = getPixelFromPercentage(screenHeight, cropBounds.y);- const x2 = x + getPixelFromPercentage(screenWidth, cropBounds.width);- const y2 = y + getPixelFromPercentage(screenHeight, cropBounds.height);- const boundaries = { x, y, x2, y2 };- const { offsetLeft, offsetTop } = this.getModalOffsets(boundaries);- onBoundaryChange(boundaries);+ const { onBoundaryChange } = this.props;+ const { x, y, width, height } = cropBounds;+ const newBoundaries = {+ x,+ y,+ x2: x + width,+ y2: y + height+ };+ const { offsetLeft, offsetTop } = this.getModalOffsets(newBoundaries);+ onBoundaryChange(newBoundaries);this.setState({offsetLeft,offsetTop,- boundaries+ boundaries: newBoundaries});}diff --git a/web/js/containers/image-download.js b/web/js/containers/image-download.jsindex e22782262..a65fee1e5 100644--- a/web/js/containers/image-download.js+++ b/web/js/containers/image-download.js@@ -9,9 +9,7 @@ import * as olProj from 'ol/proj';import { debounce as lodashDebounce } from 'lodash';import {imageUtilCalculateResolution,- imageUtilGetCoordsFromPixelValues,- getPercentageFromPixel,- getPixelFromPercentage+ imageUtilGetCoordsFromPixelValues} from '../modules/image-download/util';import util from '../util/util';import { getLayers } from '../modules/layers/selectors';@@ -33,16 +31,15 @@ class ImageDownloadContainer extends Component {super(props);const screenHeight = props.screenHeight;const screenWidth = props.screenWidth;- const boundaryProps = props.boundaries;this.state = {fileType: props.fileType,resolution: props.resolution,isWorldfile: props.isWorldfile,- boundaries: {- x: boundaryProps.x || screenWidth / 2 - 100,- y: boundaryProps.y || screenHeight / 2 - 100,- x2: boundaryProps.x2 || screenWidth / 2 + 100,- y2: boundaryProps.y2 || screenHeight / 2 + 100+ boundaries: props.boundaries || {+ x: screenWidth / 2 - 100,+ y: screenHeight / 2 - 100,+ x2: screenWidth / 2 + 100,+ y2: screenHeight / 2 + 100}};this.debounceBoundaryUpdate = lodashDebounce(@@ -53,21 +50,15 @@ class ImageDownloadContainer extends Component {}onBoundaryChange(boundaries) {- const { screenWidth, screenHeight } = this.props;- const x = getPixelFromPercentage(screenWidth, boundaries.x);- const y = getPixelFromPercentage(screenHeight, boundaries.y);- const x2 = x + getPixelFromPercentage(screenWidth, boundaries.width);- const y2 = y + getPixelFromPercentage(screenHeight, boundaries.height);+ const { x, y, width, height } = boundaries;const newBoundaries = {- x: x,- y: y,- x2: x2,- y2: y2+ x,+ y,+ x2: x + width,+ y2: y + height};- this.setState({- boundaries: newBoundaries- });+ this.setState({ boundaries: newBoundaries });this.debounceBoundaryUpdate(newBoundaries);}@@ -120,12 +111,12 @@ class ImageDownloadContainer extends Component {onPanelChange={onPanelChange}/><Crop- x={getPercentageFromPixel(screenWidth, x)}- y={getPercentageFromPixel(screenHeight, y)}+ x={x}+ y={y}+ width={x2 - x}+ height={y2 - y}maxHeight={screenHeight}maxWidth={screenWidth}- width={getPercentageFromPixel(screenWidth, x2 - x)}- height={getPercentageFromPixel(screenHeight, y2 - y)}onChange={this.onBoundaryChange}onClose={onClose}bottomLeftStyle={{