getting rid of unnecessary, undocumented 'drawn' property on marker. replacing it with accessor function isDrawn(), and putting an isDrawn() in icon as well. all tests pass r=elemoine (Closes #1759)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@8091 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2008-10-04 20:13:28 +00:00
parent 2e4faa3861
commit 8e3178984f
6 changed files with 76 additions and 4 deletions
+16
View File
@@ -193,6 +193,22 @@ OpenLayers.Icon = OpenLayers.Class({
display: function(display) {
this.imageDiv.style.display = (display) ? "" : "none";
},
/**
* APIMethod: isDrawn
*
* Returns:
* {Boolean} Whether or not the icon is drawn.
*/
isDrawn: function() {
// nodeType 11 for ie, whose nodes *always* have a parentNode
// (of type document fragment)
var isDrawn = (this.imageDiv && this.imageDiv.parentNode &&
(this.imageDiv.parentNode.nodeType != 11));
return isDrawn;
},
CLASS_NAME: "OpenLayers.Icon"
});
+2 -4
View File
@@ -125,7 +125,6 @@ OpenLayers.Layer.Markers = OpenLayers.Class(OpenLayers.Layer, {
if ((marker.icon != null) && (marker.icon.imageDiv != null) &&
(marker.icon.imageDiv.parentNode == this.div) ) {
this.div.removeChild(marker.icon.imageDiv);
marker.drawn = false;
}
}
},
@@ -156,10 +155,9 @@ OpenLayers.Layer.Markers = OpenLayers.Class(OpenLayers.Layer, {
if (px == null) {
marker.display(false);
} else {
var markerImg = marker.draw(px);
if (!marker.drawn) {
if (!marker.isDrawn()) {
var markerImg = marker.draw(px);
this.div.appendChild(markerImg);
marker.drawn = true;
}
}
},
+11
View File
@@ -129,6 +129,17 @@ OpenLayers.Marker = OpenLayers.Class({
this.lonlat = this.map.getLonLatFromLayerPx(px);
},
/**
* APIMethod: isDrawn
*
* Returns:
* {Boolean} Whether or not the marker is drawn.
*/
isDrawn: function() {
var isDrawn = (this.icon && this.icon.isDrawn());
return isDrawn;
},
/**
* Method: onScreen
*