From 04a2e9472d016148d290ddcd1ce3ee9936c5ff28 Mon Sep 17 00:00:00 2001 From: euzuro Date: Tue, 25 Jul 2006 21:43:28 +0000 Subject: [PATCH] allow an option to kill all other popups on addition of new one git-svn-id: http://svn.openlayers.org/trunk/openlayers@1004 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Map.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index 290a1166d7..3e513cd697 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -357,8 +357,17 @@ OpenLayers.Map.prototype = { /** * @param {OpenLayers.Popup} popup + * @param {Boolean} exclusive If true, closes all other popups first */ - addPopup: function(popup) { + addPopup: function(popup, exclusive) { + + if (exclusive) { + //remove all other popups from screen + for(var i=0; i < this.popups.length; i++) { + this.removePopup(this.popups[i]); + } + } + popup.map = this; this.popups.push(popup); var popupDiv = popup.draw();