update map.addPopup() to automatically add the popup at the correct screen location... and add it to the layersContainerDiv so that it will move with the maps. and example. and tests.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@300 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -161,15 +161,15 @@ OpenLayers.Map.prototype = {
|
||||
|
||||
/**
|
||||
* @param {OpenLayers.Popup} popup
|
||||
* @param {OpenLayers.Pixel} px
|
||||
*/
|
||||
addPopup: function(popup, px) {
|
||||
addPopup: function(popup) {
|
||||
this.popups.push(popup);
|
||||
var px = this.getPixelFromLonLat(popup.lonlat)
|
||||
var popupDiv = popup.draw(px);
|
||||
if (popupDiv) {
|
||||
popupDiv.style.zIndex = this.Z_INDEX_BASE['Popup'] +
|
||||
this.popups.length;
|
||||
this.viewPortDiv.appendChild(popupDiv);
|
||||
this.layerContainerDiv.appendChild(popupDiv);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -179,7 +179,7 @@ OpenLayers.Map.prototype = {
|
||||
removePopup: function(popup) {
|
||||
this.popups.remove(popup);
|
||||
if (popup.div) {
|
||||
this.viewPortDiv.removeChild(popup.div);
|
||||
this.layerContainerDiv.removeChild(popup.div);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -325,6 +325,14 @@ OpenLayers.Map.prototype = {
|
||||
if (zoomChanged != null) { // reset the layerContainerDiv's location
|
||||
this.layerContainerDiv.style.left = "0px";
|
||||
this.layerContainerDiv.style.top = "0px";
|
||||
|
||||
//redraw popups
|
||||
for (var i = 0; i < this.popups.length; i++) {
|
||||
var popup = this.popups[i];
|
||||
var px = this.getPixelFromLonLat(popup.lonlat);
|
||||
popup.moveTo(px);
|
||||
}
|
||||
|
||||
}
|
||||
var bounds = this.getExtent();
|
||||
for (var i = 0; i < this.layers.length; i++) {
|
||||
|
||||
Reference in New Issue
Block a user