diff --git a/lib/OpenLayers/Layer/Text.js b/lib/OpenLayers/Layer/Text.js index e655275a72..2124bcab01 100644 --- a/lib/OpenLayers/Layer/Text.js +++ b/lib/OpenLayers/Layer/Text.js @@ -10,6 +10,9 @@ OpenLayers.Layer.Text.prototype = * @type str */ location:null, + /** @type OpenLayers.Feature */ + selectedFeature: null, + /** * @constructor * @@ -102,11 +105,19 @@ OpenLayers.Layer.Text.prototype = } } }, + + /** + * @param {Event} evt + */ markerClick: function(evt) { + sameMarkerClicked = (this == this.layer.selectedFeature); + this.layer.selectedFeature = (!sameMarkerClicked) ? this : null; for(var i=0; i < this.layer.map.popups.length; i++) { this.layer.map.removePopup(this.layer.map.popups[i]); } - this.layer.map.addPopup(this.createPopup()); + if (!sameMarkerClicked) { + this.layer.map.addPopup(this.createPopup()); + } Event.stop(evt); } });