Merge pull request #16 from betatim/panning

Map now pans when marker is outside viewport. Closes #12
This commit is contained in:
Tim Head 2014-11-23 11:45:38 +01:00
commit 365114dd8c
1 changed files with 3 additions and 0 deletions

View File

@ -130,6 +130,9 @@ var These3Words = (function () {
this.label = label; this.label = label;
this.marker.setPosition(latLng); this.marker.setPosition(latLng);
this.marker.setTitle(label); this.marker.setTitle(label);
if (!this.map.getBounds().contains(latLng)) {
this.map.panTo(latLng);
}
}; };