Skip to content

Commit

Permalink
fix resize of google maps
Browse files Browse the repository at this point in the history
  • Loading branch information
bkueng committed Mar 31, 2017
1 parent 3332956 commit 94d1b06
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions plot_app/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<div id="google-map"></div>
<script>

var g_google_map = null;

function initMap() {

var map = new google.maps.Map(document.getElementById('google-map'), {
Expand All @@ -15,6 +17,7 @@
panControl: true,
mapTypeId: google.maps.MapTypeId.HYBRID,
});
g_google_map = map;

if(window.location.hostname == 'localhost') {
console.log('KML files do not work locally!'); //<-- important to know
Expand Down
5 changes: 5 additions & 0 deletions plot_app/templates/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ function setSize(size) {
simpler way? */
bokeh_doc = Bokeh.index[Object.keys(Bokeh.index)[0]].model.document
bokeh_doc.resize(); //trigger resize event

/* google maps resize */
if (typeof(g_google_map) !== "undefined" && g_google_map != null) {
google.maps.event.trigger(g_google_map, "resize");
}
}

{% endif %} {# is_plot_page #}
Expand Down

0 comments on commit 94d1b06

Please sign in to comment.