From 4e6c3b1f3ef4f9519539d03b4f507fc46b066120 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Mon, 26 Oct 2009 20:41:56 +0000 Subject: [PATCH] reverted change from r9754 because it breaks applications that register an event before the marker is drawn (see #2258) git-svn-id: http://svn.openlayers.org/trunk/openlayers@9764 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Marker.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/OpenLayers/Marker.js b/lib/OpenLayers/Marker.js index 88482d953e..3e0845eb5e 100644 --- a/lib/OpenLayers/Marker.js +++ b/lib/OpenLayers/Marker.js @@ -78,6 +78,7 @@ OpenLayers.Marker = OpenLayers.Class({ this.icon.offset = newIcon.offset; this.icon.calculateOffset = newIcon.calculateOffset; } + this.events = new OpenLayers.Events(this, this.icon.imageDiv, null); }, /** @@ -93,6 +94,9 @@ OpenLayers.Marker = OpenLayers.Class({ this.map = null; + this.events.destroy(); + this.events = null; + if (this.icon != null) { this.icon.destroy(); this.icon = null; @@ -111,9 +115,6 @@ OpenLayers.Marker = OpenLayers.Class({ * location passed-in */ draw: function(px) { - if (!this.events) { - this.events = new OpenLayers.Events(this, this.icon.imageDiv, null); - } return this.icon.draw(px); }, @@ -125,10 +126,6 @@ OpenLayers.Marker = OpenLayers.Class({ if (this.icon != null) { this.icon.erase(); } - if (this.events) { - this.events.destroy(); - this.events = null; - } }, /**