add 'selectedFeature' member to Layer.Text so that when the user clicks a second time on the same marker, the popup disappears.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@456 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -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]);
|
||||
}
|
||||
if (!sameMarkerClicked) {
|
||||
this.layer.map.addPopup(this.createPopup());
|
||||
}
|
||||
Event.stop(evt);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user