Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

fix image-download breaking bug

Benjamin King50e52e283d5e
diff --git a/web/js/containers/image-download.js b/web/js/containers/image-download.js
index 3d9c2779c..2ae164d8e 100644
--- a/web/js/containers/image-download.js
+++ b/web/js/containers/image-download.js
@@ -79,7 +79,7 @@ class ImageDownloadContainer extends Component {
const geolonlat2 = olProj.transform(lonlats[1], crs, 'EPSG:4326');
const resolution = imageUtilCalculateResolution(
- Math.round(map.getZoom()),
+ Math.round(map.ui.selected.getView().getZoom()),
isGeoProjection,
proj.selected.resolutions
);
diff --git a/web/js/containers/toolbar.js b/web/js/containers/toolbar.js
index d6e6d62af..547757c8b 100644
--- a/web/js/containers/toolbar.js
+++ b/web/js/containers/toolbar.js
@@ -8,6 +8,7 @@ import Projection from './projection';
import InfoList from './info';
import ShareLinks from './share';
import ErrorBoundary from './error-boundary';
+import { get as lodashGet } from 'lodash';
import {
requestNotifications,
setNotifications
@@ -84,7 +85,8 @@ class toolbarContainer extends Component {
openModal,
notificationType,
notificationContentNumber,
- config
+ config,
+ isImageDownloadActive
} = this.props;
const notificationClass = notificationType
? ' wv-status-' + notificationType
@@ -124,7 +126,12 @@ class toolbarContainer extends Component {
)}
<Button
id="wv-image-button"
- className="wv-toolbar-button"
+ className={
+ isImageDownloadActive
+ ? 'wv-toolbar-button'
+ : 'wv-toolbar-button disabled'
+ }
+ disabled={!isImageDownloadActive}
title="Take a snapshot"
onClick={() =>
openModal(
@@ -157,7 +164,8 @@ function mapStateToProps(state) {
return {
notificationType: type,
notificationContentNumber: number,
- config: state.config
+ config: state.config,
+ isImageDownloadActive: Boolean(lodashGet(state, 'legacy.map.ui.selected'))
};
}
const mapDispatchToProps = dispatch => ({