From b944b3b729c1a79ad85c95ee0ff2f9d0228511df Mon Sep 17 00:00:00 2001 From: FrozenCow Date: Thu, 21 Jul 2011 23:59:14 +0200 Subject: [PATCH] Fixed previous maptype/layer being visible in the background. --- web/js/map.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/web/js/map.js b/web/js/map.js index e3ad9c90..9b040f92 100644 --- a/web/js/map.js +++ b/web/js/map.js @@ -315,16 +315,18 @@ DynMap.prototype = { } me.world = mapWorld; me.maptype = map; - me.map.addLayer(me.maptype); + + if (projectionChanged || worldChanged) { + var centerLocation = $.extend({ x: 0, y: 64, z: 0 }, mapWorld.center); + var centerPoint = me.getProjection().fromLocationToLatLng(centerLocation); + me.map.setView(centerPoint, 0, true); + } + + me.map.addLayer(me.maptype, false); if (worldChanged) { $(me).trigger('worldchanged'); } - if (projectionChanged || worldChanged) { - var centerLocation = $.extend({ x: 0, y: 64, z: 0 }, mapWorld.center); - var centerPoint = map.getProjection().fromLocationToLatLng(centerLocation); - me.map.setView(centerPoint, 0, true); - } $(me).trigger('mapchanged'); $('.map', me.worldlist).removeClass('selected');