Skip to content

Commit

Permalink
Remove flex layout for OL map
Browse files Browse the repository at this point in the history
The initial approach of having a CSS flex layout for the app, so the OL
map graps automatically the available space was buggy on large screens.
This removes the flex layout and sets the avaible height for the OL map
via JavaScript.
  • Loading branch information
chrismayer committed Aug 6, 2018
1 parent c89e772 commit a7a0606
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
8 changes: 1 addition & 7 deletions src/assets/css/wegue.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ html {
.wgu-app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
position: relative;
width: 100vw;
height: 100vh;
display: flex;
flex-direction: column;
width: 100%;
}
.wgu-app-embedded {
width: 100%;
Expand All @@ -19,11 +16,8 @@ html {
}

.wgu-app .wgu-map {
/* temp. solution since flex: 1 doe not work as expected */
height: calc(100vh - 56px);
}
.wgu-app-embedded .wgu-map {
height: calc(100% - 56px);
}

.wgu-app-logo {
Expand Down
2 changes: 1 addition & 1 deletion src/components/AppHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export default {
<style>
.wgu-app-toolbar {
/*background-color: red;*/
z-index: 1;
display: block;
}
</style>
10 changes: 10 additions & 0 deletions src/components/ol/Map.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ export default {
// Send the event 'ol-map-mounted' with the OL map as payload
WguEventBus.$emit('ol-map-mounted', this.map)
const appHeaderEl = document.querySelector('.wgu-app-toolbar');
if (appHeaderEl) {
const headerHeight = appHeaderEl.offsetHeight;
if (this.$isEmbedded) {
this.map.getTarget().style.height = 'calc(100% - ' + headerHeight + 'px)';
} else {
this.map.getTarget().style.height = 'calc(100vh - ' + headerHeight + 'px)';
}
}
// resize the map, so it fits to parent
window.setTimeout(() => {
this.map.updateSize();
Expand Down

0 comments on commit a7a0606

Please sign in to comment.