removed px member from OpenLayers.Popup. user must now specify a px value in the draw() method, just like with markers. updated tests

git-svn-id: http://svn.openlayers.org/trunk/openlayers@252 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-05-22 11:45:38 +00:00
parent d2c18d4de7
commit 2410d94107
4 changed files with 28 additions and 40 deletions

View File

@@ -4,7 +4,6 @@
OpenLayers.Popup = Class.create();
OpenLayers.Popup.count = 0;
OpenLayers.Popup.PX = new OpenLayers.Pixel(0, 0);
OpenLayers.Popup.SIZE = new OpenLayers.Size(200, 200);
OpenLayers.Popup.COLOR = "white";
OpenLayers.Popup.OPACITY = 1;
@@ -21,9 +20,6 @@ OpenLayers.Popup.prototype = {
/** @type DOMElement */
div: null,
/** @type OpenLayers.Pixel */
px: null,
/** @type OpenLayers.Size*/
size: null,
@@ -44,15 +40,13 @@ OpenLayers.Popup.prototype = {
* @constructor
*
* @param {String} id
* @param {OpenLayers.Pixel} px
* @param {OpenLayers.Size} size
* @param {String} contentHTML
*/
initialize:function(id, px, size, contentHTML) {
initialize:function(id, size, contentHTML) {
OpenLayers.Popup.count += 1;
this.id = (id != null) ? id : "Popup" + OpenLayers.Popup.count;
this.px = (px != null) ? px : OpenLayers.Popup.PX;
this.size = (size != null) ? size : OpenLayers.Popup.SIZE;
if (contentHTML != null) {
this.contentHTML = contentHTML;
@@ -72,24 +66,35 @@ OpenLayers.Popup.prototype = {
},
/**
* @param {OpenLayers.Pixel} px
*/
draw: function() {
draw: function(px) {
if (this.div == null) {
this.div = OpenLayers.Util.createDiv(this.id + "_div",
null,
null,
"hidden");
}
this.setPx();
this.setSize();
this.setBackgroundColor();
this.setOpacity();
this.setBorder();
this.setContentHTML();
this.moveTo(px);
return this.div;
},
/**
* @param {OpenLayers.Pixel} px
*/
moveTo: function(px) {
if (this.div != null) {
this.div.style.left = px.x + "px";
this.div.style.top = px.y + "px";
}
},
/**
* @param {OpenLayers.Size} size
*/
@@ -104,21 +109,6 @@ OpenLayers.Popup.prototype = {
}
},
/**
* @param {OpenLayers.Pixel} px
*/
setPx:function(px) {
if (px != undefined) {
this.px = px;
}
if (this.div != null) {
this.div.style.left = this.px.x;
this.div.style.top = this.px.y;
}
},
/**
* @param {String} color
*/