diff --git a/lib/OpenLayers/Layer/Vector.js b/lib/OpenLayers/Layer/Vector.js index 79e7c7d050..e394c0a660 100644 --- a/lib/OpenLayers/Layer/Vector.js +++ b/lib/OpenLayers/Layer/Vector.js @@ -479,12 +479,13 @@ OpenLayers.Layer.Vector = OpenLayers.Class(OpenLayers.Layer, { if (!dragging) { this.renderer.root.style.visibility = 'hidden'; - var viewPortWidth = this.map.viewPortDiv.clientWidth; - var viewPortHeight = this.map.viewPortDiv.clientHeight; - var offsetLeft = (viewPortWidth / 2 * this.ratio) - viewPortWidth / 2; + var viewSize = this.map.getSize(), + viewWidth = viewSize.w, + viewHeight = viewSize.h, + offsetLeft = (viewWidth / 2 * this.ratio) - viewWidth / 2, + offsetTop = (viewHeight / 2 * this.ratio) - viewHeight / 2; offsetLeft += parseInt(this.map.layerContainerDiv.style.left, 10); offsetLeft = -Math.round(offsetLeft); - var offsetTop = (viewPortHeight / 2 * this.ratio) - viewPortHeight / 2; offsetTop += parseInt(this.map.layerContainerDiv.style.top, 10); offsetTop = -Math.round(offsetTop);