|
1 | | -/*! jquery-locationpicker - v0.1.14 - 2016-09-20 */ |
| 1 | +/*! jquery-locationpicker - v0.1.15 - 2016-09-26 */ |
2 | 2 | (function($) { |
3 | 3 | function GMapContext(domElement, options) { |
4 | 4 | var _map = new google.maps.Map(domElement, options); |
|
91 | 91 | var address = GmUtility.addressByFormat(results, gmapContext.settings.addressFormat); |
92 | 92 | gmapContext.locationName = address.formatted_address; |
93 | 93 | gmapContext.addressComponents = GmUtility.address_component_from_google_geocode(address.address_components); |
| 94 | + } else if (status == google.maps.GeocoderStatus.OVER_QUERY_LIMIT) { |
| 95 | + return setTimeout(function() { |
| 96 | + GmUtility.updateLocationName(gmapContext, callback); |
| 97 | + }, 1e3); |
94 | 98 | } |
95 | 99 | if (callback) { |
96 | 100 | callback.call(this, gmapContext); |
|
148 | 152 | if (inputBinding) { |
149 | 153 | if (inputBinding.radiusInput) { |
150 | 154 | inputBinding.radiusInput.on("change", function(e) { |
151 | | - if (!e.originalEvent) { |
| 155 | + var radiusInputValue = $(this).val(); |
| 156 | + if (!e.originalEvent || isNaN(radiusInputValue)) { |
152 | 157 | return; |
153 | 158 | } |
154 | | - gmapContext.radius = $(this).val(); |
| 159 | + gmapContext.radius = radiusInputValue; |
155 | 160 | GmUtility.setPosition(gmapContext, gmapContext.location, function(context) { |
156 | 161 | context.settings.onchanged.apply(gmapContext.domContainer, [ GmUtility.locationFromLatLng(context.location), context.radius, false ]); |
157 | 162 | }); |
|
204 | 209 | } |
205 | 210 | if (inputBinding.latitudeInput) { |
206 | 211 | inputBinding.latitudeInput.on("change", function(e) { |
207 | | - if (!e.originalEvent) { |
| 212 | + var latitudeInputValue = $(this).val(); |
| 213 | + if (!e.originalEvent || isNaN(latitudeInputValue)) { |
208 | 214 | return; |
209 | 215 | } |
210 | | - GmUtility.setPosition(gmapContext, new google.maps.LatLng($(this).val(), gmapContext.location.lng()), function(context) { |
| 216 | + GmUtility.setPosition(gmapContext, new google.maps.LatLng(latitudeInputValue, gmapContext.location.lng()), function(context) { |
211 | 217 | context.settings.onchanged.apply(gmapContext.domContainer, [ GmUtility.locationFromLatLng(context.location), context.radius, false ]); |
212 | 218 | updateInputValues(gmapContext.settings.inputBinding, gmapContext); |
213 | 219 | }); |
214 | 220 | }); |
215 | 221 | } |
216 | 222 | if (inputBinding.longitudeInput) { |
217 | 223 | inputBinding.longitudeInput.on("change", function(e) { |
218 | | - if (!e.originalEvent) { |
| 224 | + var longitudeInputValue = $(this).val(); |
| 225 | + if (!e.originalEvent || isNaN(longitudeInputValue)) { |
219 | 226 | return; |
220 | 227 | } |
221 | | - GmUtility.setPosition(gmapContext, new google.maps.LatLng(gmapContext.location.lat(), $(this).val()), function(context) { |
| 228 | + GmUtility.setPosition(gmapContext, new google.maps.LatLng(gmapContext.location.lat(), longitudeInputValue), function(context) { |
222 | 229 | context.settings.onchanged.apply(gmapContext.domContainer, [ GmUtility.locationFromLatLng(context.location), context.radius, false ]); |
223 | 230 | updateInputValues(gmapContext.settings.inputBinding, gmapContext); |
224 | 231 | }); |
|
306 | 313 | return; |
307 | 314 | } |
308 | 315 | var settings = $.extend({}, $.fn.locationpicker.defaults, options); |
309 | | - var gmapContext = new GMapContext(this, { |
| 316 | + var gmapContext = new GMapContext(this, $.extend({}, settings.mapOptions, { |
310 | 317 | zoom: settings.zoom, |
311 | 318 | center: new google.maps.LatLng(settings.location.latitude, settings.location.longitude), |
312 | 319 | mapTypeId: settings.mapTypeId, |
|
324 | 331 | markerIcon: settings.markerIcon, |
325 | 332 | markerDraggable: settings.markerDraggable, |
326 | 333 | markerVisible: settings.markerVisible |
327 | | - }); |
| 334 | + })); |
328 | 335 | $target.data("locationpicker", gmapContext); |
329 | 336 | function displayMarkerWithSelectedArea() { |
330 | 337 | GmUtility.setPosition(gmapContext, gmapContext.marker.position, function(context) { |
|
369 | 376 | zoom: 15, |
370 | 377 | mapTypeId: google.maps.MapTypeId.ROADMAP, |
371 | 378 | styles: [], |
| 379 | + mapOptions: {}, |
372 | 380 | scrollwheel: true, |
373 | 381 | inputBinding: { |
374 | 382 | latitudeInput: null, |
|
0 commit comments