From f9dd2661f8cfd345aed9e1876b2698dd0832ccb6 Mon Sep 17 00:00:00 2001 From: rolux Date: Tue, 19 Jun 2012 17:36:08 +0200 Subject: [PATCH] chasing a map positioning bug... --- source/Ox.UI/js/Map/Map.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/source/Ox.UI/js/Map/Map.js b/source/Ox.UI/js/Map/Map.js index c731984e..5e1cb00c 100644 --- a/source/Ox.UI/js/Map/Map.js +++ b/source/Ox.UI/js/Map/Map.js @@ -874,7 +874,14 @@ Ox.Map = function(options, self) { google.maps.event.addListener(self.map, 'idle', mapChanged); google.maps.event.addListener(self.map, 'zoom_changed', zoomChanged); google.maps.event.addListenerOnce(self.map, 'tilesloaded', tilesLoaded); - google.maps.event.trigger(self.map, 'resize'); + + // Google seems to sometimes set position to 'relative' + if (self.$map.css('position') == 'absolute') { + self.$map.css({position: 'absolute'}); + that.resizeMap(); + } else { + google.maps.event.trigger(self.map, 'resize'); + } // needed to get mouse x/y coordinates on marker mouseover, // see http://code.google.com/p/gmaps-api-issues/issues/detail?id=2342 @@ -918,14 +925,9 @@ Ox.Map = function(options, self) { } updateFormElements(); - //that.gainFocus(); self.loaded = true; that.triggerEvent('load'); - function tilesLoaded() { - setTimeout(formatTerms, 250); - } - }); } @@ -1335,6 +1337,10 @@ Ox.Map = function(options, self) { } } + function tilesLoaded() { + setTimeout(formatTerms, 250); + } + function toggleControls() { var $controls = that.find('.OxMapControl'); self.options.showControls = !self.options.showControls;