Commit 222bda4f authored by Sean Blommaert's avatar Sean Blommaert
Browse files

Issue #2474867 by acrollet: Maps in vertical tabs/fieldsets do not render correctly

parent 1a1128c2
Loading
Loading
Loading
Loading
+15
Changes for geofield_gmap.js: 15 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -78,6 +78,21 @@ function geofield_gmap_initialize(params) {
    google.maps.event.trigger(map, 'resize');
  });

  // Fix map issue in fieldgroups / vertical tabs
  // https://www.drupal.org/node/2474867.
  google.maps.event.addListenerOnce(map, "idle", function () {
    // Show all map tiles when a map is shown in a vertical tab.
    jQuery('#' + params.mapid).closest('div.vertical-tabs').find('.vertical-tab-button a').click(function () {
      google.maps.event.trigger(map, 'resize');
      geofield_gmap_center(params.mapid);
    });
    // Show all map tiles when a map is shown in a collapsible fieldset.
    jQuery('#' + params.mapid).closest('fieldset.collapsible').find('a.fieldset-title').click(function () {
      google.maps.event.trigger(map, 'resize');
      geofield_gmap_center(params.mapid);
    });
  });

  var marker = new google.maps.Marker({
    map: map,
    draggable: params.widget