fix for #784 -- adds some commenting and readability to the tile.draw() function

git-svn-id: http://svn.openlayers.org/trunk/openlayers@3462 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2007-06-27 23:48:25 +00:00
parent 357a4cee35
commit 33c87bf3b6

View File

@@ -77,14 +77,38 @@ OpenLayers.Tile.prototype = {
},
/**
*/
draw:function() {
* Clear whatever is currently in the tile, then return whether or not
* it should actually be re-drawn.
*
* @returns Whether or not the tile should actually be drawn. Note that
* this is not really the best way of doing things, but such is
* the way the code has been developed. Subclasses call this and
* depend on the return to know if they should draw or not.
* @type Boolean
*/
draw: function() {
//clear tile's contents and mark as not drawn
this.clear();
return ((this.layer.displayOutsideMaxExtent
|| (this.layer.maxExtent
&& this.bounds.intersectsBounds(this.layer.maxExtent, false)))
&& !(this.layer.buffer == 0
&& !this.bounds.intersectsBounds(this.layer.map.getExtent(), false)));
var maxExtent = this.layer.maxExtent;
var withinMaxExtent = (maxExtent &&
this.bounds.intersectsBounds(maxExtent, false));
var mapExtent = this.layer.map.getExtent();
var withinMapExtent = (mapExtent &&
this.bounds.intersectsBounds(mapExtent, false));
// There are two cases where we *wouldn't* want to draw the tile:
//
// 1) If the tile is outside its layer's maxExtent
// 2) When the layer's buffer is 0, if the tile is outside the map's
// extent (out of view)
//
// ...what we return is the opposite of the above conditions :-)
//
return ( (withinMaxExtent || this.layer.displayOutsideMaxExtent) &&
(withinMapExtent || (this.layer.buffer != 0)) );
},
/**