Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

WIP mobile embed vector dialog

Ed Plato8744cb164d20
diff --git a/web/js/containers/map-interactions/ol-vector-interactions.js b/web/js/containers/map-interactions/ol-vector-interactions.js
index 478e016ac..504a268c5 100644
--- a/web/js/containers/map-interactions/ol-vector-interactions.js
+++ b/web/js/containers/map-interactions/ol-vector-interactions.js
@@ -158,20 +158,20 @@ function mapStateToProps(state) {
{
backdrop: false,
clickableBehindModal: true,
- desktopOnly: true,
- isDraggable: true,
+ desktopOnly: false,
+ isDraggable: !isMobile,
wrapClassName: 'vector-modal-wrap',
modalClassName: 'vector-modal light',
CompletelyCustomModal: vectorDialog,
- isResizable: true,
+ isResizable: !isMobile,
dragHandle: '.modal-header',
dialogKey,
key: dialogKey,
vectorMetaObject: lodashGroupBy(metaArray, 'id'),
- width: isMobile ? 250 : 445,
+ width: isMobile ? 320 : 445,
height: 300,
- offsetLeft,
- offsetTop,
+ offsetLeft: isMobile ? 0 : offsetLeft,
+ offsetTop: isMobile ? 40 : offsetTop,
timeout: 0,
onClose: () => {
setTimeout(() => {
diff --git a/web/js/containers/modal.js b/web/js/containers/modal.js
index efe4d4762..8d09a8727 100644
--- a/web/js/containers/modal.js
+++ b/web/js/containers/modal.js
@@ -59,14 +59,30 @@ class ModalContainer extends Component {
}
getStyle() {
+ const {
+ isEmbedModeActive, screenHeight, screenWidth, isMobile,
+ } = this.props;
const {
offsetLeft, offsetRight, offsetTop, width, height,
} = this.state;
+ const top = (isMobile || isEmbedModeActive) && height ? screenHeight - height : offsetTop;
+ if (isEmbedModeActive) {
+ return {
+ left: 10,
+ top,
+ width: screenWidth - 10,
+ height,
+ maxHeight: height,
+ transform: 'scale(0.75)',
+ transformOrigin: 'left',
+ };
+ }
+
return {
left: offsetLeft,
right: offsetRight,
- top: offsetTop,
+ top,
width,
height,
maxHeight: height,
@@ -247,9 +263,9 @@ function mapStateToProps(state) {
bodyTemplate = state[template];
isTemplateModal = true;
}
- const isMobile = browser.lessThan.medium;
+ const { screenHeight, screenWidth, lessThan } = browser;
+ const isMobile = lessThan.medium;
const { isEmbedModeActive } = embed;
-
return {
isOpen,
bodyText,
@@ -258,8 +274,8 @@ function mapStateToProps(state) {
id,
isEmbedModeActive,
isMobile,
- screenHeight: isMobile ? undefined : state.browser.screenHeight,
- screenWidth: isMobile ? undefined : state.browser.screenWidth,
+ screenHeight,
+ screenWidth,
bodyTemplate,
isTemplateModal,
customProps,