From f6b34a5b118d6999649bf0c91dcf68584bc856d0 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Fri, 14 Feb 2014 17:49:35 +0100 Subject: [PATCH] Fixes map center then refreshing it --- wcfsetup/install/files/js/WCF.Location.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/wcfsetup/install/files/js/WCF.Location.js b/wcfsetup/install/files/js/WCF.Location.js index ae77ac00fb..0910ace6eb 100644 --- a/wcfsetup/install/files/js/WCF.Location.js +++ b/wcfsetup/install/files/js/WCF.Location.js @@ -276,7 +276,13 @@ WCF.Location.GoogleMaps.Map = Class.extend({ * Refreshes the map. */ refresh: function() { + // save current center since resize does not preserve it + var $center = this._map.getCenter(); + google.maps.event.trigger(this._map, 'resize'); + + // set center to old value again + this._map.setCenter($center); }, /** @@ -714,7 +720,10 @@ WCF.Location.GoogleMaps.Util = { * @param google.maps.Marker marker */ focusMarker: function(marker) { + console.log(marker.getPosition().lat(), marker.getPosition().lng()); + console.log(marker.getMap().getCenter().lat(), marker.getMap().getCenter().lng()); marker.getMap().setCenter(marker.getPosition()); + console.log(marker.getMap().getCenter().lat(), marker.getMap().getCenter().lng()); }, /** -- 2.20.1