Don't use clientWidth and clientHeight.
Instead, use map.getSize to make sure this works the same way in all browsers.
This commit is contained in:
@@ -479,12 +479,13 @@ OpenLayers.Layer.Vector = OpenLayers.Class(OpenLayers.Layer, {
|
|||||||
if (!dragging) {
|
if (!dragging) {
|
||||||
this.renderer.root.style.visibility = 'hidden';
|
this.renderer.root.style.visibility = 'hidden';
|
||||||
|
|
||||||
var viewPortWidth = this.map.viewPortDiv.clientWidth;
|
var viewSize = this.map.getSize(),
|
||||||
var viewPortHeight = this.map.viewPortDiv.clientHeight;
|
viewWidth = viewSize.w,
|
||||||
var offsetLeft = (viewPortWidth / 2 * this.ratio) - viewPortWidth / 2;
|
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 += parseInt(this.map.layerContainerDiv.style.left, 10);
|
||||||
offsetLeft = -Math.round(offsetLeft);
|
offsetLeft = -Math.round(offsetLeft);
|
||||||
var offsetTop = (viewPortHeight / 2 * this.ratio) - viewPortHeight / 2;
|
|
||||||
offsetTop += parseInt(this.map.layerContainerDiv.style.top, 10);
|
offsetTop += parseInt(this.map.layerContainerDiv.style.top, 10);
|
||||||
offsetTop = -Math.round(offsetTop);
|
offsetTop = -Math.round(offsetTop);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user