|
1 |
| -/*! jquery-locationpicker - v0.1.13 - 2016-09-12 */ |
| 1 | +/*! jquery-locationpicker - v0.1.13 - 2016-09-13 */ |
2 | 2 | (function($) {
|
3 | 3 | function GMapContext(domElement, options) {
|
4 | 4 | var _map = new google.maps.Map(domElement, options);
|
|
313 | 313 | markerVisible: settings.markerVisible
|
314 | 314 | });
|
315 | 315 | $target.data("locationpicker", gmapContext);
|
| 316 | + function displayMarkerWithSelectedArea() { |
| 317 | + GmUtility.setPosition(gmapContext, gmapContext.marker.position, function(context) { |
| 318 | + var currentLocation = GmUtility.locationFromLatLng(gmapContext.location); |
| 319 | + context.settings.onchanged.apply(gmapContext.domContainer, [ currentLocation, context.radius, true ]); |
| 320 | + updateInputValues(gmapContext.settings.inputBinding, gmapContext); |
| 321 | + }); |
| 322 | + } |
| 323 | + if (settings.markerInCenter) { |
| 324 | + gmapContext.map.addListener("bounds_changed", function() { |
| 325 | + if (!gmapContext.marker.dragging) { |
| 326 | + gmapContext.marker.setPosition(gmapContext.map.center); |
| 327 | + updateInputValues(gmapContext.settings.inputBinding, gmapContext); |
| 328 | + } |
| 329 | + }); |
| 330 | + gmapContext.map.addListener("idle", function() { |
| 331 | + if (!gmapContext.marker.dragging) { |
| 332 | + displayMarkerWithSelectedArea(); |
| 333 | + } |
| 334 | + }); |
| 335 | + } |
316 | 336 | google.maps.event.addListener(gmapContext.marker, "drag", function(event) {
|
317 |
| - updateInputValues(gmapContext.settings.inputBinding, gmapContext); |
318 | 337 | if (gmapContext.settings.inputBinding.locationNameInput) {
|
319 | 338 | GmUtility.updateLocationName(gmapContext);
|
320 | 339 | }
|
| 340 | + updateInputValues(gmapContext.settings.inputBinding, gmapContext); |
321 | 341 | });
|
322 | 342 | google.maps.event.addListener(gmapContext.marker, "dragend", function(event) {
|
323 |
| - GmUtility.setPosition(gmapContext, gmapContext.marker.position, function(context) { |
324 |
| - var currentLocation = GmUtility.locationFromLatLng(gmapContext.location); |
325 |
| - context.settings.onchanged.apply(gmapContext.domContainer, [ currentLocation, context.radius, true ]); |
326 |
| - updateInputValues(gmapContext.settings.inputBinding, gmapContext); |
327 |
| - }); |
| 343 | + displayMarkerWithSelectedArea(); |
328 | 344 | });
|
329 | 345 | GmUtility.setPosition(gmapContext, new google.maps.LatLng(settings.location.latitude, settings.location.longitude), function(context) {
|
330 | 346 | updateInputValues(settings.inputBinding, gmapContext);
|
|
0 commit comments