From bda9a03dc6bf03cdb61a87faaf0b25efc56d4089 Mon Sep 17 00:00:00 2001 From: Elliot Lewis Date: Mon, 13 Jun 2016 15:27:27 +0100 Subject: [PATCH 1/2] Allow override of default zoom In the situation of having 1 (or more markers) and fitBounds = false. Being option to override the default zoom level of 10. *If Google Maps isn't using fitBounds, map requires center-point and zoom: ttps://developers.google.com/maps/documentation/javascript/tutorial#MapOptions --- resources/js/plugin.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/js/plugin.js b/resources/js/plugin.js index 6a0d82d..a093de4 100644 --- a/resources/js/plugin.js +++ b/resources/js/plugin.js @@ -72,7 +72,7 @@ var GoogleMaps = { (options.lat ? options.lat : 0), (options.lng ? options.lng : 0) ), - zoom: 10 + zoom: (options.zoom ? options.zoom : 10) }; this.el = node; @@ -1856,4 +1856,4 @@ var GoogleMaps = { }); -}()); \ No newline at end of file +}()); From 07c29c646540d815a6d94fd703c73f83156e85ad Mon Sep 17 00:00:00 2001 From: Elliot Lewis Date: Thu, 16 Jun 2016 19:48:00 +0100 Subject: [PATCH 2/2] [bugfix] for zoom [bugfix] fixed so options argument works correctly for zoom --- resources/js/plugin.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/resources/js/plugin.js b/resources/js/plugin.js index a093de4..b87aac4 100644 --- a/resources/js/plugin.js +++ b/resources/js/plugin.js @@ -68,11 +68,8 @@ var GoogleMaps = { } var defaultMapOptions = { - center: new google.maps.LatLng( - (options.lat ? options.lat : 0), - (options.lng ? options.lng : 0) - ), - zoom: (options.zoom ? options.zoom : 10) + center: new google.maps.LatLng(0,0), + zoom: 10 }; this.el = node; @@ -91,7 +88,7 @@ var GoogleMaps = { this.base(options); - this.options = _.extend({}, defaultMapOptions, this.options); + this.options = _.extend({}, defaultMapOptions, options); this.api = new google.maps.Map(node, this.options);