maxZIndex becomes NULL when the last feature is removed, p=pvalsecc, r=me (closes #1670)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@7712 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Éric Lemoine
2008-08-08 12:23:59 +00:00
parent 0493525660
commit 3791712a10
2 changed files with 95 additions and 5 deletions

View File

@@ -128,24 +128,37 @@ OpenLayers.ElementsIndexer = OpenLayers.Class({
// Reset the maxium z-index based on the last item in the
// order array.
var lastId = this.order[this.order.length - 1];
this.maxZIndex = this.indices[lastId];
if (this.order.length > 0) {
var lastId = this.order[this.order.length - 1];
this.maxZIndex = this.indices[lastId];
} else {
this.maxZIndex = 0;
}
}
},
/**
* APIMethod: clear
*/
clear: function() {
this.order = [];
this.indices = {};
this.maxZIndex = 0;
},
/**
* APIMethod: exists
*
*
* Parameters:
* node- {DOMElement} The node to test for existence.
*
*
* Returns:
* {Boolean} Whether or not the node exists in the indexer?
*/
exists: function(node) {
return (this.indices[node.id] != null);
},
/**
* APIMethod: getZIndex
* Get the z-index value for the current node from the node data itself.
@@ -395,6 +408,7 @@ OpenLayers.Renderer.Elements = OpenLayers.Class(OpenLayers.Renderer, {
this.root.removeChild(this.root.firstChild);
}
}
this.indexer.clear();
},
/**