Pull up r2181:r2229 to 2.3 branch. Includes fixes for:

#429 fix panning for odd size viewport
#478 Double clicking overview map expand/contract button zooms in Safari
#484 conflict between _addButton of MouseToolbar and PanZoom
#485 null pointer exception on CTRL+F5 in IE for WMS.Untiled
#486 add a few sanity checks to overview map
#489 requires tag incorrect in OverviewMap.js   
#498 overviewmap: rectangle has minimum height in IE



git-svn-id: http://svn.openlayers.org/branches/openlayers/2.3@2230 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Schuyler Erle
2007-02-16 19:08:01 +00:00
parent 7232cfa3a0
commit b7bf7d5436
6 changed files with 100 additions and 20 deletions

View File

@@ -6,11 +6,11 @@
* @author Tim Schaub
*/
// @require: OpenLayers/Control.js
/**
* @class
*/
* @class
*
* @requires OpenLayers/Control.js
*/
OpenLayers.Control.OverviewMap = OpenLayers.Class.create();
OpenLayers.Control.OverviewMap.prototype =
@@ -106,6 +106,7 @@ OpenLayers.Control.OverviewMap.prototype =
this.extentRectangle = document.createElement('div');
this.extentRectangle.style.position = 'absolute';
this.extentRectangle.style.zIndex = 1000; //HACK
this.extentRectangle.style.overflow = 'hidden';
this.extentRectangle.style.backgroundImage = 'url(' +
OpenLayers.Util.getImagesLocation() +
'/blank.png)';
@@ -162,6 +163,11 @@ OpenLayers.Control.OverviewMap.prototype =
OpenLayers.Event.observe(this.maximizeDiv,
'click',
this.maximizeControl.bindAsEventListener(this));
OpenLayers.Event.observe(this.maximizeDiv,
'dblclick',
function(e) {
OpenLayers.Event.stop(e);
});
this.div.appendChild(this.maximizeDiv);
// minimize button div
@@ -177,7 +183,11 @@ OpenLayers.Control.OverviewMap.prototype =
OpenLayers.Event.observe(this.minimizeDiv,
'click',
this.minimizeControl.bindAsEventListener(this));
OpenLayers.Event.observe(this.minimizeDiv,
'dblclick',
function(e) {
OpenLayers.Event.stop(e);
});
this.div.appendChild(this.minimizeDiv);
this.minimizeControl();
@@ -418,12 +428,14 @@ OpenLayers.Control.OverviewMap.prototype =
// The base layer for overview map needs to be in the same projection
// as the base layer for the main map. This should be made more robust.
if(this.map.units != 'degrees') {
if(this.map.getProjection() != this.ovmap.getProjection()) {
if(this.ovmap.getProjection() && (this.map.getProjection() != this.ovmap.getProjection())) {
alert('The overview map only works when it is in the same projection as the main map');
}
}
var pxBounds = this.getRectBoundsFromMapBounds(this.map.getExtent());
this.setRectPxBounds(pxBounds);
if (pxBounds) {
this.setRectPxBounds(pxBounds);
}
},
/**
@@ -479,8 +491,12 @@ OpenLayers.Control.OverviewMap.prototype =
lonLatBounds.top);
var leftBottomPx = this.getOverviewPxFromLonLat(leftBottomLonLat);
var rightTopPx = this.getOverviewPxFromLonLat(rightTopLonLat);
return new OpenLayers.Bounds(leftBottomPx.x, leftBottomPx.y,
rightTopPx.x, rightTopPx.y);
var bounds = null;
if (leftBottomPx && rightTopPx) {
bounds = new OpenLayers.Bounds(leftBottomPx.x, leftBottomPx.y,
rightTopPx.x, rightTopPx.y);
}
return bounds;
},
/**
@@ -530,10 +546,13 @@ OpenLayers.Control.OverviewMap.prototype =
getOverviewPxFromLonLat: function(lonlat) {
var res = this.ovmap.getResolution();
var extent = this.ovmap.getExtent();
return new OpenLayers.Pixel(
Math.round(1/res * (lonlat.lon - extent.left)),
Math.round(1/res * (extent.top - lonlat.lat))
);
var px = null;
if (extent) {
px = new OpenLayers.Pixel(
Math.round(1/res * (lonlat.lon - extent.left)),
Math.round(1/res * (extent.top - lonlat.lat)));
}
return px;
},
/** @final @type String */