Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

WV-2124: Bottom of Vector Modal cutoff when changing orientation in mobile view (#3979)

Tom834550eb08e1
diff --git a/web/js/containers/map-interactions/ol-vector-interactions.js b/web/js/containers/map-interactions/ol-vector-interactions.js
index 27d7ef324..7e7823d4b 100644
--- a/web/js/containers/map-interactions/ol-vector-interactions.js
+++ b/web/js/containers/map-interactions/ol-vector-interactions.js
@@ -308,6 +308,9 @@ const mapDispatchToProps = (dispatch) => ({
const dialogKey = new Date().getUTCMilliseconds();
const modalClassName = isEmbedModeActive && !isMobile ? 'vector-modal light modal-embed' : 'vector-modal light';
const mobileTopOffset = 106;
+ const modalWidth = isMobile ? screenWidth : 445;
+ const modalHeight = isMobile ? screenHeight - mobileTopOffset : 300;
+
dispatch(openCustomContent(dialogId,
{
backdrop: false,
@@ -323,8 +326,8 @@ const mapDispatchToProps = (dispatch) => ({
dialogKey,
key: dialogKey,
vectorMetaObject: lodashGroupBy(metaArray, 'id'),
- width: isMobile ? screenWidth : 445,
- height: isMobile ? screenHeight - mobileTopOffset : 300,
+ width: modalWidth,
+ height: modalHeight,
offsetLeft: isMobile ? 0 : offsetLeft,
offsetTop: isMobile ? 40 : offsetTop,
timeout: 0,
diff --git a/web/js/containers/modal.js b/web/js/containers/modal.js
index a4c8e020b..53f7d88be 100644
--- a/web/js/containers/modal.js
+++ b/web/js/containers/modal.js
@@ -46,7 +46,6 @@ class ModalContainer extends Component {
screenHeight,
screenWidth,
} = this.props;
- // Populate props from custom obj
const newProps = isCustom && id ? update(this.props, { $merge: customProps }) : this.props;
const {
onToggle,
@@ -62,7 +61,15 @@ class ModalContainer extends Component {
toggleFunction();
}
if (customProps.mobileFullScreen && (screenHeightChanged || screenWidthChanged)) {
- this.onResize(null, { size: { width: screenWidth, height: screenHeight } });
+ const isPortrait = screenHeight > screenWidth;
+
+ // Values below match the request made in ol-vector-interactions
+ const sizeObj = {
+ width: isPortrait ? screenWidth : 445,
+ height: isPortrait ? screenHeight - 106 : 300,
+ };
+
+ this.onResize(null, { size: sizeObj });
}
}
}
@@ -122,7 +129,6 @@ class ModalContainer extends Component {
screenHeight,
} = this.props;
const { width, height } = this.state;
- // Populate props from custom obj
const newProps = isCustom && id ? update(this.props, { $merge: customProps }) : this.props;
const {
autoFocus,