From bcf17845edc460527d6feb4015726cd4a0ced49b Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 4 Feb 2014 12:56:52 +0100 Subject: [PATCH] Perform automatic reverse geocoding on marker drag end-event --- wcfsetup/install/files/js/WCF.Location.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/wcfsetup/install/files/js/WCF.Location.js b/wcfsetup/install/files/js/WCF.Location.js index c8ca727bfd..0eef61e9ad 100644 --- a/wcfsetup/install/files/js/WCF.Location.js +++ b/wcfsetup/install/files/js/WCF.Location.js @@ -500,6 +500,8 @@ WCF.Location.GoogleMaps.LocationInput = Class.extend({ } }, this)); } + + this._marker.addListener('dragend', $.proxy(this._updateLocation, this)); }, /** @@ -520,6 +522,17 @@ WCF.Location.GoogleMaps.LocationInput = Class.extend({ return this._marker; }, + /** + * Updates location on marker position change. + */ + _updateLocation: function() { + WCF.Location.GoogleMaps.Util.reverseGeocoding($.proxy(function(result) { + if (result !== null) { + $(this._searchInput).val(result); + } + }, this), this._marker); + }, + /** * Sets the marker based on an entered location. * -- 2.20.1