|
1539 | 1539 | processData: function (mappingObject, originPoint, data, page) {
|
1540 | 1540 | var _this = this;
|
1541 | 1541 | var i = 0;
|
1542 |
| - var orig_lat, orig_lng, origin, name, maxDistance, firstRun, marker, bounds, storeStart, storeNumToShow, myOptions, noResults; |
| 1542 | + var orig_lat, orig_lng, origin, name, maxDistance, firstRun, marker, bounds, storeStart, storeNumToShow, myOptions, noResults, distError; |
1543 | 1543 | if (!this.isEmptyObject(mappingObject)) {
|
1544 | 1544 | orig_lat = mappingObject.lat;
|
1545 | 1545 | orig_lng = mappingObject.lng;
|
|
1709 | 1709 | else {
|
1710 | 1710 | if (_this.settings.distanceAlert !== -1 && locationset[0].distance > _this.settings.distanceAlert) {
|
1711 | 1711 | _this.notify(_this.settings.distanceErrorAlert + _this.settings.distanceAlert + ' ' + distUnit);
|
| 1712 | + distError = true; |
1712 | 1713 | }
|
1713 | 1714 | }
|
1714 | 1715 |
|
|
1773 | 1774 | }
|
1774 | 1775 |
|
1775 | 1776 | // Google maps settings
|
1776 |
| - if ((_this.settings.fullMapStart === true && firstRun === true) || (_this.settings.mapSettings.zoom === 0) || (typeof origin === 'undefined')) { |
| 1777 | + if ((_this.settings.fullMapStart === true && firstRun === true) || (_this.settings.mapSettings.zoom === 0) || (typeof origin === 'undefined') || (distError === true)) { |
1777 | 1778 | myOptions = _this.settings.mapSettings;
|
1778 | 1779 | bounds = new google.maps.LatLngBounds();
|
1779 | 1780 | }
|
|
1798 | 1799 | // Create the map
|
1799 | 1800 | var map = new google.maps.Map(document.getElementById(_this.settings.mapID), myOptions);
|
1800 | 1801 |
|
1801 |
| - // Re-center the map when the browser is resized |
| 1802 | + // Re-center the map when the browser is re-sized |
1802 | 1803 | google.maps.event.addDomListener(window, 'resize', function() {
|
1803 | 1804 | var center = map.getCenter();
|
1804 | 1805 | google.maps.event.trigger(map, 'resize');
|
|
1879 | 1880 | marker = _this.createMarker(point, locationset[y].name, locationset[y].address, letter, map, locationset[y].category);
|
1880 | 1881 | marker.set('id', y);
|
1881 | 1882 | markers[y] = marker;
|
1882 |
| - if ((_this.settings.fullMapStart === true && firstRun === true) || (_this.settings.mapSettings.zoom === 0) || (typeof origin === 'undefined')) { |
| 1883 | + if ((_this.settings.fullMapStart === true && firstRun === true) || (_this.settings.mapSettings.zoom === 0) || (typeof origin === 'undefined') || (distError === true)) { |
1883 | 1884 | bounds.extend(point);
|
1884 | 1885 | }
|
1885 | 1886 | // Pass variables to the pop-up infowindows
|
1886 | 1887 | _this.createInfowindow(marker, null, infowindow, storeStart, page);
|
1887 | 1888 | }
|
1888 | 1889 |
|
1889 |
| - // Center and zoom if no origin or zoom was provided |
1890 |
| - if ((_this.settings.fullMapStart === true && firstRun === true) || (_this.settings.mapSettings.zoom === 0) || (typeof origin === 'undefined')) { |
| 1890 | + // Center and zoom if no origin or zoom was provided, or distance of first marker is greater than distanceAlert |
| 1891 | + if ((_this.settings.fullMapStart === true && firstRun === true) || (_this.settings.mapSettings.zoom === 0) || (typeof origin === 'undefined') || (distError === true)) { |
1891 | 1892 | map.fitBounds(bounds);
|
1892 | 1893 | }
|
1893 | 1894 |
|
|
0 commit comments