diff --git a/lib/OpenLayers/Control/OverviewMap.js b/lib/OpenLayers/Control/OverviewMap.js index 11ac354330..619912408d 100644 --- a/lib/OpenLayers/Control/OverviewMap.js +++ b/lib/OpenLayers/Control/OverviewMap.js @@ -157,7 +157,7 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, { this.handlers.drag.destroy(); } - this.mapDiv.removeChild(this.extentRectangle); + this.ovmap && this.ovmap.viewPortDiv.removeChild(this.extentRectangle); this.extentRectangle = null; if (this.rectEvents) { @@ -229,7 +229,6 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, { this.extentRectangle.style.position = 'absolute'; this.extentRectangle.style.zIndex = 1000; //HACK this.extentRectangle.className = this.displayClass+'ExtentRectangle'; - this.mapDiv.appendChild(this.extentRectangle); this.element.appendChild(this.mapDiv); @@ -490,6 +489,7 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, { {controls: [], maxResolution: 'auto', fallThrough: false}, this.mapOptions); this.ovmap = new OpenLayers.Map(this.mapDiv, options); + this.ovmap.viewPortDiv.appendChild(this.extentRectangle); // prevent ovmap from being destroyed when the page unloads, because // the OverviewMap control has to do this (and does it). diff --git a/lib/OpenLayers/Control/PanZoomBar.js b/lib/OpenLayers/Control/PanZoomBar.js index eb1f544e18..567e2ce938 100644 --- a/lib/OpenLayers/Control/PanZoomBar.js +++ b/lib/OpenLayers/Control/PanZoomBar.js @@ -286,9 +286,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, { if (!OpenLayers.Event.isLeftClick(evt)) { return; } - var y = evt.xy.y; - var top = OpenLayers.Util.pagePosition(evt.object)[1]; - var levels = (y - top)/this.zoomStopHeight; + var levels = evt.xy.y / this.zoomStopHeight; if(this.forceFixedZoomLevel || !this.map.fractionalZoom) { levels = Math.floor(levels); }