Skip to content

Commit

Permalink
Fixed map not rendering in secondary tab
Browse files Browse the repository at this point in the history
  • Loading branch information
Tam committed Jun 20, 2016
1 parent 2c43fd0 commit 7c14c05
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion SimpleMapPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function getDescription()

public function getVersion()
{
return '1.2.0';
return '1.2.1';
}

public function getSchemaVersion()
Expand Down
8 changes: 8 additions & 0 deletions releases.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
]
}
]
1 change: 1 addition & 0 deletions resources/SimpleMap_Map.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.simplemap--map {
display: block;
border-radius: 3px;
border: 1px solid #e3e5e8;
}
Expand Down
14 changes: 14 additions & 0 deletions resources/SimpleMap_Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 7c14c05

Please sign in to comment.