Skip to content

Commit

Permalink
fix: fixed map not being centered properly on initial page load
Browse files Browse the repository at this point in the history
  • Loading branch information
Endebert committed Aug 9, 2018
1 parent f1e0a6f commit 87b36a4
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/Map.vue
Original file line number Diff line number Diff line change
Expand Up @@ -553,16 +553,19 @@ export default {
// since selectedMap is already defined and doesn't trigger changeMap, we do it here manually
this.changeMap(this.selectedMap);
}
setTimeout(() => {
let executions = 0;
const interval = setInterval(() => {
executions++;
executions %= 4;
// dirty hack to set map position to fixed on mobile devices
// on mobile safari, map doesn't show if not fixed
// but if always fixed, persistent navbar is over map on desktop, which is clunky
// so this is the compromise.
if (this.drawer) {
document.getElementById("map").style.position = "relative";
}
if (this.drawer) { document.getElementById("map").style.position = "relative"; }
this.map.invalidateSize();
}, 10);
if (executions === 0) { clearInterval(interval); }
}, 250);
},
methods: {
/**
Expand Down

0 comments on commit 87b36a4

Please sign in to comment.