add code to Map.js to allow for the addittion and removal of popups. add a new html file to play around with popups. add a test in the test_Map file for the popup adding/removing
git-svn-id: http://svn.openlayers.org/trunk/openlayers@227 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -42,6 +42,9 @@ OpenLayers.Map.prototype = {
|
||||
// Array(OpenLayers.Control)
|
||||
controls: null,
|
||||
|
||||
// Array(OpenLayers.Popup)
|
||||
popups: null,
|
||||
|
||||
// OpenLayers.LonLat
|
||||
center: null,
|
||||
|
||||
@@ -85,6 +88,8 @@ OpenLayers.Map.prototype = {
|
||||
this.addControl( new OpenLayers.Control.PanZoom() );
|
||||
this.addControl( new OpenLayers.Control.MouseDefaults() );
|
||||
|
||||
this.popups = new Array();
|
||||
|
||||
// always call map.destroy()
|
||||
Event.observe(window, 'unload',
|
||||
this.destroy.bindAsEventListener(this));
|
||||
@@ -142,6 +147,28 @@ OpenLayers.Map.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {OpenLayers.Popup} popup
|
||||
*/
|
||||
addPopup: function(popup) {
|
||||
popup.map = this;
|
||||
this.popups.push(popup);
|
||||
var popupDiv = popup.draw();
|
||||
if (popupDiv) {
|
||||
popupDiv.style.zIndex = this.Z_INDEX_BASE['Popup'] +
|
||||
this.popups.length;
|
||||
this.viewPortDiv.appendChild(popupDiv);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {OpenLayers.Popup} popup
|
||||
*/
|
||||
removePopup: function(popup) {
|
||||
this.popups.remove(popup);
|
||||
this.viewPortDiv.removeChild(popup.div);
|
||||
},
|
||||
|
||||
/**
|
||||
* @return {float}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user