Remove Icon-specific code from Markers Layer, patch by meek,me,
r=euzuro. (Closes #818) git-svn-id: http://svn.openlayers.org/trunk/openlayers@9233 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -78,6 +78,9 @@ OpenLayers.Icon = OpenLayers.Class({
|
||||
* references and memory leaks
|
||||
*/
|
||||
destroy: function() {
|
||||
// erase any drawn elements
|
||||
this.erase();
|
||||
|
||||
OpenLayers.Event.stopObservingElement(this.imageDiv.firstChild);
|
||||
this.imageDiv.innerHTML = "";
|
||||
this.imageDiv = null;
|
||||
@@ -143,6 +146,16 @@ OpenLayers.Icon = OpenLayers.Class({
|
||||
return this.imageDiv;
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: erase
|
||||
* Erase the underlying image element.
|
||||
*
|
||||
*/
|
||||
erase: function() {
|
||||
if (this.imageDiv != null && this.imageDiv.parentNode != null) {
|
||||
OpenLayers.Element.remove(this.imageDiv);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: setOpacity
|
||||
|
||||
@@ -122,10 +122,7 @@ OpenLayers.Layer.Markers = OpenLayers.Class(OpenLayers.Layer, {
|
||||
removeMarker: function(marker) {
|
||||
if (this.markers && this.markers.length) {
|
||||
OpenLayers.Util.removeItem(this.markers, marker);
|
||||
if ((marker.icon != null) && (marker.icon.imageDiv != null) &&
|
||||
(marker.icon.imageDiv.parentNode == this.div) ) {
|
||||
this.div.removeChild(marker.icon.imageDiv);
|
||||
}
|
||||
marker.erase();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -89,6 +89,9 @@ OpenLayers.Marker = OpenLayers.Class({
|
||||
* know which layer it is attached to.)
|
||||
*/
|
||||
destroy: function() {
|
||||
// erase any drawn features
|
||||
this.erase();
|
||||
|
||||
this.map = null;
|
||||
|
||||
this.events.destroy();
|
||||
@@ -115,6 +118,16 @@ OpenLayers.Marker = OpenLayers.Class({
|
||||
return this.icon.draw(px);
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: erase
|
||||
* Erases any drawn elements for this marker.
|
||||
*/
|
||||
erase: function() {
|
||||
if (this.icon != null) {
|
||||
this.icon.erase();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: moveTo
|
||||
* Move the marker to the new location.
|
||||
|
||||
Reference in New Issue
Block a user