Skip to content

Commit 1dd4686

Browse files
committed
Added a zoom listener after fitBounds is used to prevent high zoom levels after name search and taxonomy filtering
1 parent 9ed5bda commit 1dd4686

File tree

7 files changed

+26
-9
lines changed

7 files changed

+26
-9
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jquery-storelocator-plugin",
3-
"version": "3.1.4",
3+
"version": "3.1.5",
44
"description": "This jQuery plugin takes advantage of Google Maps API version 3 to create an easy to implement store locator. No back-end programming is required, you just need to feed it KML, XML, or JSON data with all the location information.",
55
"repository": {
66
"type": "git",

dist/assets/js/plugins/storeLocator/jquery.storelocator.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! jQuery Google Maps Store Locator - v3.1.4 - 2021-06-06
1+
/*! jQuery Google Maps Store Locator - v3.1.5 - 2021-09-26
22
* http://www.bjornblog.com/web/jquery-store-locator-plugin
33
* Copyright (c) 2021 Bjorn Holine; Licensed MIT */
44

@@ -3007,7 +3007,6 @@
30073007
_this.map.setCenter(center);
30083008
});
30093009

3010-
30113010
// Add map drag listener if setting is enabled and re-search on drag end
30123011
if (_this.settings.dragSearch === true ) {
30133012
_this.map.addListener('dragend', function() {
@@ -3072,6 +3071,14 @@
30723071
// Center and zoom if no origin or zoom was provided, or distance of first marker is greater than distanceAlert
30733072
if ((_this.settings.fullMapStart === true && firstRun === true && _this.settings.querystringParams !== true) || (_this.settings.mapSettings.zoom === 0) || (typeof origin === 'undefined') || (distError === true)) {
30743073
_this.map.fitBounds(bounds);
3074+
3075+
// Prevent zooming in too far after fitBounds
3076+
var zoomListener = google.maps.event.addListener(_this.map, 'idle', function() {
3077+
if (_this.map.getZoom() > 16) {
3078+
_this.map.setZoom(16);
3079+
}
3080+
google.maps.event.removeListener(zoomListener);
3081+
});
30753082
}
30763083

30773084
// Create the links that focus on the related marker

dist/assets/js/plugins/storeLocator/jquery.storelocator.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jquery-storelocator-plugin",
3-
"version": "3.1.4",
3+
"version": "3.1.5",
44
"description": "This jQuery plugin takes advantage of Google Maps API version 3 to create an easy to implement store locator. No back-end programming is required, you just need to feed it KML, XML, or JSON data with all the location information.",
55
"repository": {
66
"type": "git",

readme.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,11 @@ filtering.
3535

3636
## Changelog
3737

38+
### Version 3.1.5
39+
* Added a zoom listener after fitBounds is used to prevent high zoom levels after name search and taxonomy filtering.
40+
3841
### Version 3.1.4
39-
* Fixed name search filter value not clearing if form input is cleared
42+
* Fixed name search filter value not clearing if form input is cleared.
4043

4144
### Version 3.1.3
4245

src/js/jquery.storelocator.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3003,7 +3003,6 @@
30033003
_this.map.setCenter(center);
30043004
});
30053005

3006-
30073006
// Add map drag listener if setting is enabled and re-search on drag end
30083007
if (_this.settings.dragSearch === true ) {
30093008
_this.map.addListener('dragend', function() {
@@ -3068,6 +3067,14 @@
30683067
// Center and zoom if no origin or zoom was provided, or distance of first marker is greater than distanceAlert
30693068
if ((_this.settings.fullMapStart === true && firstRun === true && _this.settings.querystringParams !== true) || (_this.settings.mapSettings.zoom === 0) || (typeof origin === 'undefined') || (distError === true)) {
30703069
_this.map.fitBounds(bounds);
3070+
3071+
// Prevent zooming in too far after fitBounds
3072+
var zoomListener = google.maps.event.addListener(_this.map, 'idle', function() {
3073+
if (_this.map.getZoom() > 16) {
3074+
_this.map.setZoom(16);
3075+
}
3076+
google.maps.event.removeListener(zoomListener);
3077+
});
30713078
}
30723079

30733080
// Create the links that focus on the related marker

storelocator.jquery.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"title": "jQuery Google Maps Store Locator",
44
"description": "This jQuery plugin takes advantage of Google Maps API version 3 to create an easy to implement store locator. No back-end programming is required, you just need to feed it KML, XML, or JSON data with all the location information.",
55
"keywords": ["jquery","locator","store","dealer","location", "locations", "maps", "map", "stores", "find"],
6-
"version": "3.1.4",
6+
"version": "3.1.5",
77
"author": {
88
"name": "Bjorn Holine",
99
"url": "http://www.bjornblog.com/"

0 commit comments

Comments
 (0)