Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

WV-2393 Setting area of interest without moving bounding box (#3966)

Ryan Weilereccdd2e4d343
diff --git a/web/js/containers/sidebar/smart-handoff.js b/web/js/containers/sidebar/smart-handoff.js
index 68b37cf04..003a1c5d6 100644
--- a/web/js/containers/sidebar/smart-handoff.js
+++ b/web/js/containers/sidebar/smart-handoff.js
@@ -168,8 +168,8 @@ class SmartHandoff extends Component {
const newBoundaries = {
x,
y,
- x2: x + width,
- y2: y + height,
+ x2: width ? x + width : boundaries.x2,
+ y2: height ? y + height : boundaries.y2,
};
const lonlats = imageUtilGetCoordsFromPixelValues(
@@ -233,12 +233,13 @@ class SmartHandoff extends Component {
* Handle bounding box checkbox toggle
*/
onCheckboxToggle() {
- const { showBoundingBox } = this.state;
+ const { showBoundingBox, boundaries } = this.state;
if (!showBoundingBox) {
googleTagManager.pushEvent({
event: 'smart_handoffs_toggle_true_target_area',
});
this.setState({ showBoundingBox: true });
+ this.onBoundaryChange(boundaries, true);
} else {
this.setState({
showBoundingBox: false,
diff --git a/web/js/modules/smart-handoff/util.js b/web/js/modules/smart-handoff/util.js
index cf5ba8aa5..ee0184fc1 100644
--- a/web/js/modules/smart-handoff/util.js
+++ b/web/js/modules/smart-handoff/util.js
@@ -41,6 +41,14 @@ function getHandoffParams (queryInput, options) {
projection, conceptId, startDate, endDate, currentExtent, showBoundingBox,
} = options;
+ Object.entries(options).forEach(([key, value]) => {
+ if (value === undefined) {
+ console.error(`${key} is undefined.`);
+ } else if (value === {}) {
+ console.error(`${key} is an empty object.`);
+ }
+ });
+
const getParam = ({ ValueType, ValueName }) => {
if (ValueType === 'temporalRange') {
if (startDate && endDate) {