From c8c9b51e7382ccb346aee545e8be123e3a331cc9 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Mon, 8 Nov 2010 12:26:40 +0000 Subject: [PATCH] Fixed OverviewMap and PanZoomBar controls. The former was broken because the extent rectangle div now has to be added to the viewPortDiv instead of the div, and the latter because it uses pagePosition where it doesn't need to, with an incorrect argument. r=fredj (closes #2247) git-svn-id: http://svn.openlayers.org/trunk/openlayers@10878 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Control/OverviewMap.js | 4 ++-- lib/OpenLayers/Control/PanZoomBar.js | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) 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); }