Fixed ElementsIndexer to not stop at elements that are not currently

rendered. Thanks Adam Borrows for catching and describing this and the 
patch which does exactly the right thing. r=me (closes #1986)


git-svn-id: http://svn.openlayers.org/trunk/openlayers@9177 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
ahocevar
2009-04-03 16:29:00 +00:00
parent 49774f6ab5
commit 8b0208ae44

View File

@@ -109,9 +109,7 @@ OpenLayers.ElementsIndexer = OpenLayers.Class({
// If the new node should be before another in the index
// order, return the node before which we have to insert the new one;
// else, return null to indicate that the new node can be appended.
var nextIndex = rightIndex + 1;
return nextIndex < this.order.length ?
OpenLayers.Util.getElement(this.order[nextIndex]) : null;
return this.getNextElement(rightIndex);
},
/**
@@ -200,6 +198,30 @@ OpenLayers.ElementsIndexer = OpenLayers.Class({
this.maxZIndex = zIndex;
}
},
/**
* APIMethod: getNextElement
* Get the next element in the order stack.
*
* Parameters:
* index - {Integer} The index of the current node in this.order.
*
* Returns:
* {DOMElement} the node following the index passed in, or
* null.
*/
getNextElement: function(index) {
var nextIndex = index + 1;
if (nextIndex < this.order.length){
var nextElement = OpenLayers.Util.getElement(this.order[nextIndex]);
if (nextElement == undefined){
nextElement = this.getNextElement(nextIndex);
}
return nextElement;
} else {
return null;
}
},
CLASS_NAME: "OpenLayers.ElementsIndexer"
});