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:
+31
-7
@@ -77,14 +77,38 @@ OpenLayers.Tile.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
* Clear whatever is currently in the tile, then return whether or not
|
||||||
draw:function() {
|
* 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();
|
this.clear();
|
||||||
return ((this.layer.displayOutsideMaxExtent
|
|
||||||
|| (this.layer.maxExtent
|
var maxExtent = this.layer.maxExtent;
|
||||||
&& this.bounds.intersectsBounds(this.layer.maxExtent, false)))
|
var withinMaxExtent = (maxExtent &&
|
||||||
&& !(this.layer.buffer == 0
|
this.bounds.intersectsBounds(maxExtent, false));
|
||||||
&& !this.bounds.intersectsBounds(this.layer.map.getExtent(), 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)) );
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user