diff --git a/README.md b/README.md index c6433ad..5f1dcab 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,9 @@ You can search for elements using the location specified in your map field. When ## Changelog +### 1.2.1 +- Fixed bug where map would not display correctly when in a secondary tab. + ### 1.2.0 - **Added search and sorting support.** - Added optional Google API Server Key setting diff --git a/SimpleMapPlugin.php b/SimpleMapPlugin.php index d94d753..8de3be5 100644 --- a/SimpleMapPlugin.php +++ b/SimpleMapPlugin.php @@ -24,7 +24,7 @@ public function getDescription() public function getVersion() { - return '1.2.0'; + return '1.2.1'; } public function getSchemaVersion() diff --git a/releases.json b/releases.json index 3bd7085..8f35273 100644 --- a/releases.json +++ b/releases.json @@ -60,5 +60,13 @@ "Added optional Google API Server Key setting", "**_WARNING:_** This update will break any map fields that are NOT standalone (global) or in a Matrix field." ] + }, + { + "version": "1.2.1", + "downloadUrl": "https://github.com/ethercreative/SimpleMap/archive/v1.2.1.zip", + "date": "2016-06-20T10:00:00-08:00", + "notes": [ + "- Fixed bug where map would not display correctly when in a secondary tab." + ] } ] \ No newline at end of file diff --git a/resources/SimpleMap_Map.css b/resources/SimpleMap_Map.css index a5bda87..1715575 100644 --- a/resources/SimpleMap_Map.css +++ b/resources/SimpleMap_Map.css @@ -1,4 +1,5 @@ .simplemap--map { + display: block; border-radius: 3px; border: 1px solid #e3e5e8; } diff --git a/resources/SimpleMap_Map.js b/resources/SimpleMap_Map.js index b0d59b1..b87990d 100644 --- a/resources/SimpleMap_Map.js +++ b/resources/SimpleMap_Map.js @@ -46,6 +46,20 @@ var SimpleMap = function (mapId, settings) { document.addEventListener('SimpleMapsGAPILoaded', function () { if (!self.setup) self.setupMap(); }); + + // Re-draw map on tab change + [].slice.call(document.getElementById('tabs').getElementsByTagName('a')).forEach(function (el) { + el.addEventListener('click', function () { + var x = self.map.getZoom(), + c = self.map.getCenter(); + + setTimeout(function () { + google.maps.event.trigger(self.map,'resize'); + self.map.setZoom(x); + self.map.setCenter(c); + }, 1); + }); + }); }; SimpleMap.Fail = function (message) {