[OpenLayers-Dev] OverviewMap extentRectangle

Jeff Dege jdege at korterra.com
Thu Jul 26 12:31:49 EDT 2007


In Openlayers/Control/OverviewMap.js, in the function
OpenLayers.Control.OverviewMap.setRectPxBounds(), we have two lines:

	this.extentRectangle.style.height = parseInt(Math.max(bottom -
top, 0))+ 'px';
	this.extentRectangle.style.width = parseInt(Math.max(right -
left, 0)) + 'px';

These set the width and height of the extent rectangle, as it is being
drawn in the OverviewMap.

Because of the Math.max(..., 0), we prevent negative widths or heights.
But we do allow for zero widths and height.  Which means that the
extentRectangle is sometimes not drawn at all.

This is only an issue if you are using a single-scaled overview map, or
if you have maxRatio set fairly large.  But if you are using a
single-scaled overview map, you probably want the extent rectangle to be
drawn.

MapServer replaces the box with a cross-hair, when the box gets small.
I'm not suggesting that, right now.  But I do think that we should set
the minimum size of the extentRectangle so that it is always visible.

I've been playing with this in IE6, and from what I can see, widths and
heights of 1 are also no drawn.  So I'd suggest:

	this.extentRectangle.style.height = parseInt(Math.max(bottom -
top, 2))+ 'px';
	this.extentRectangle.style.width = parseInt(Math.max(right -
left, 2)) + 'px';



More information about the Dev mailing list