From: Alexander Ebert Date: Tue, 4 Feb 2014 11:56:52 +0000 (+0100) Subject: Perform automatic reverse geocoding on marker drag end-event X-Git-Tag: 2.0.3~56^2~6 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=bcf17845edc460527d6feb4015726cd4a0ced49b;p=GitHub%2FWoltLab%2FWCF.git Perform automatic reverse geocoding on marker drag end-event --- 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. *