Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Fix modal offset bug #2144

Benjamin Kingc9fd7fd67593
diff --git a/web/js/components/map/ol-coordinates.js b/web/js/components/map/ol-coordinates.js
index aa601d3b4..3d028407a 100644
--- a/web/js/components/map/ol-coordinates.js
+++ b/web/js/components/map/ol-coordinates.js
@@ -42,11 +42,11 @@ class OlCoordinates extends React.Component {
const metaArray = clickObj.metaArray || [];
const selected = clickObj.selected || {};
const offsetLeft = clickObj.offsetLeft || 10;
- const dialogId = 'vector_dialog';
+ const dialogId = 'vector_dialog' + pixels[0] + pixels[1];
const isVectorModalOpen = modalState.id.includes('vector_dialog') && modalState.isOpen;
if (metaArray.length) {
- openVectorDiaglog(dialogId, metaArray, isVectorModalOpen ? undefined : offsetLeft);
+ openVectorDiaglog(dialogId, metaArray, offsetLeft);
}
if (Object.entries(selected).length || (Object.entries(lastSelected).length && !isVectorModalOpen)) {
selectVectorFeatures(selected);
@@ -144,6 +144,7 @@ const mapDispatchToProps = dispatch => ({
CompletelyCustomModal: vectorDialog,
isDraggable: true,
isResizable: true,
+ offsetTop: 100,
vectorMetaObject: lodashGroupBy(metaArray, 'id'),
width: 445,
height: 300,
diff --git a/web/js/containers/modal.js b/web/js/containers/modal.js
index b210b34dd..63f9ed0dd 100644
--- a/web/js/containers/modal.js
+++ b/web/js/containers/modal.js
@@ -28,21 +28,20 @@ class ModalContainer extends Component {
height: props.customProps.height,
isDraggable: props.isDraggable
};
- this._style = {}
this.onResize = this.onResize.bind(this);
}
getStyle(state, props) {
const isResizable = props.isResizable;
- this._style = {
- left: props.offsetLeft || this._style.left,
+ return {
+ left: props.offsetLeft,
right: props.offsetRight,
top: props.offsetTop,
width: isResizable ? state.width : props.width,
height: isResizable ? state.height : props.height,
maxHeight: isResizable ? state.height : props.height
}
- return this._style;
+
}
onResize(e, { size }) {
diff --git a/web/js/modules/vector-styles/util.js b/web/js/modules/vector-styles/util.js
index db32087b8..aac18c615 100644
--- a/web/js/modules/vector-styles/util.js
+++ b/web/js/modules/vector-styles/util.js
@@ -156,7 +156,7 @@ export function onMapClickGetVectorFeatures(pixels, map, state) {
const metaArray = [];
const selected = {};
const config = state.config;
- const { screenHeight, screenWidth } = state.browser;
+ const { screenWidth } = state.browser;
const x = pixels[0];
const isOnLeft = screenWidth - x >= screenWidth / 2;
const modalWidth = 445;