Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

WV-2179 (#3824)

Jason Kent751077dd0579
diff --git a/web/js/app.js b/web/js/app.js
index f759314f1..2226dcb14 100644
--- a/web/js/app.js
+++ b/web/js/app.js
@@ -103,17 +103,18 @@ class App extends React.Component {
componentDidMount() {
document.addEventListener('keydown', this.handleKeyPress);
- // We listen to the resize event
window.addEventListener('resize', this.setVhCSSProperty);
+ window.addEventListener('orientationchange', this.setVhCSSProperty);
}
componentWillUnmount() {
document.removeEventListener('keydown', this.handleKeyPress);
+ window.removeEventListener('resize', this.setVhCSSProperty);
+ window.removeEventListener('orientationchange', this.setVhCSSProperty);
}
// https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
setVhCSSProperty = () => {
- // We execute the same script as before
const vh = window.innerHeight * 0.01;
document.documentElement.style.setProperty('--vh', `${vh}px`);
}
diff --git a/web/js/map/ui.js b/web/js/map/ui.js
index 6e07a4fe6..0a748c323 100644
--- a/web/js/map/ui.js
+++ b/web/js/map/ui.js
@@ -228,6 +228,9 @@ export default function mapui(models, config, store, ui) {
});
events.on('redux:action-dispatched', subscribeToStore);
events.on('map:reload-layers', reloadLayers);
+ window.addEventListener('orientationchange', () => {
+ updateProjection(true);
+ });
updateProjection(true);
};