Changeset 7897 for trunk/openlayers/lib/OpenLayers
- Timestamp:
- 08/29/08 12:28:20 (3 months ago)
- Files:
-
- trunk/openlayers/lib/OpenLayers/Popup.js (modified) (8 diffs)
- trunk/openlayers/lib/OpenLayers/Popup/Anchored.js (modified) (4 diffs)
- trunk/openlayers/lib/OpenLayers/Popup/AnchoredBubble.js (modified) (3 diffs)
- trunk/openlayers/lib/OpenLayers/Popup/Framed.js (modified) (4 diffs)
- trunk/openlayers/lib/OpenLayers/Popup/FramedCloud.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/lib/OpenLayers/Popup.js
r7887 r7897 49 49 50 50 /** 51 * Property: contentSize 52 * {<OpenLayers.Size>} the width and height of the content. 53 */ 54 contentSize: null, 55 56 /** 51 57 * Property: size 52 58 * {<OpenLayers.Size>} the width and height of the popup. … … 184 190 * lonlat - {<OpenLayers.LonLat>} The position on the map the popup will 185 191 * be shown. 186 * size - {<OpenLayers.Size>} The size of the popup.192 * contentSize - {<OpenLayers.Size>} The size of the content. 187 193 * contentHTML - {String} An HTML string to display inside the 188 194 * popup. … … 191 197 * closeBoxCallback - {Function} Function to be called on closeBox click. 192 198 */ 193 initialize:function(id, lonlat, size, contentHTML, closeBox, closeBoxCallback) {199 initialize:function(id, lonlat, contentSize, contentHTML, closeBox, closeBoxCallback) { 194 200 if (id == null) { 195 201 id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_"); … … 198 204 this.id = id; 199 205 this.lonlat = lonlat; 200 this.size = (size != null) ? size 206 207 this.contentSize = (contentSize != null) ? contentSize 201 208 : new OpenLayers.Size( 202 209 OpenLayers.Popup.WIDTH, … … 219 226 220 227 var id = this.div.id + "_contentDiv"; 221 this.contentDiv = OpenLayers.Util.createDiv(id, null, this. size.clone(),228 this.contentDiv = OpenLayers.Util.createDiv(id, null, this.contentSize.clone(), 222 229 null, "relative"); 223 230 this.contentDiv.className = this.contentDisplayClass; … … 311 318 312 319 this.moveTo(px); 313 if (!this.autoSize ) {314 this.setSize(this. size);320 if (!this.autoSize && !this.size) { 321 this.setSize(this.contentSize); 315 322 } 316 323 this.setBackgroundColor(); … … 400 407 * 401 408 * Parameters: 402 * size - {<OpenLayers.Size>} the new size of the popup's contents div 403 * (in pixels). 404 */ 405 setSize:function(size) { 406 this.size = size; 407 408 var contentSize = this.size.clone(); 409 * contentSize - {<OpenLayers.Size>} the new size for the popup's 410 * contents div (in pixels). 411 */ 412 setSize:function(contentSize) { 413 this.size = contentSize.clone(); 409 414 410 415 // if our contentDiv has a css 'padding' set on it by a stylesheet, we … … 434 439 // me want to shoot someone, but so it goes. 435 440 if (OpenLayers.Util.getBrowserName() == "msie") { 436 contentSize.w += contentDivPadding.left + contentDivPadding.right; 437 contentSize.h += contentDivPadding.bottom + contentDivPadding.top; 441 this.contentSize.w += 442 contentDivPadding.left + contentDivPadding.right; 443 this.contentSize.h += 444 contentDivPadding.bottom + contentDivPadding.top; 438 445 } 439 446 trunk/openlayers/lib/OpenLayers/Popup/Anchored.js
r7656 r7897 36 36 * id - {String} 37 37 * lonlat - {<OpenLayers.LonLat>} 38 * size - {<OpenLayers.Size>}38 * contentSize - {<OpenLayers.Size>} 39 39 * contentHTML - {String} 40 40 * anchor - {Object} Object which must expose a 'size' <OpenLayers.Size> … … 43 43 * closeBoxCallback - {Function} Function to be called on closeBox click. 44 44 */ 45 initialize:function(id, lonlat, size, contentHTML, anchor, closeBox,45 initialize:function(id, lonlat, contentSize, contentHTML, anchor, closeBox, 46 46 closeBoxCallback) { 47 var newArguments = new Array(id, lonlat, size, contentHTML, closeBox, 48 closeBoxCallback); 47 var newArguments = [ 48 id, lonlat, contentSize, contentHTML, closeBox, closeBoxCallback 49 ]; 49 50 OpenLayers.Popup.prototype.initialize.apply(this, newArguments); 50 51 … … 109 110 * 110 111 * Parameters: 111 * size - {<OpenLayers.Size>} 112 * contentSize - {<OpenLayers.Size>} the new size for the popup's 113 * contents div (in pixels). 112 114 */ 113 setSize:function( size) {115 setSize:function(contentSize) { 114 116 OpenLayers.Popup.prototype.setSize.apply(this, arguments); 115 117 … … 165 167 calculateNewPx:function(px) { 166 168 var newPx = px.offset(this.anchor.offset); 169 170 //use contentSize if size is not already set 171 var size = this.size || this.contentSize; 167 172 168 173 var top = (this.relativePosition.charAt(0) == 't'); 169 newPx.y += (top) ? - this.size.h : this.anchor.size.h;174 newPx.y += (top) ? -size.h : this.anchor.size.h; 170 175 171 176 var left = (this.relativePosition.charAt(1) == 'l'); 172 newPx.x += (left) ? - this.size.w : this.anchor.size.w;177 newPx.x += (left) ? -size.w : this.anchor.size.w; 173 178 174 179 return newPx; trunk/openlayers/lib/OpenLayers/Popup/AnchoredBubble.js
r6718 r7897 29 29 * id - {String} 30 30 * lonlat - {<OpenLayers.LonLat>} 31 * size - {<OpenLayers.Size>}31 * contentSize - {<OpenLayers.Size>} 32 32 * contentHTML - {String} 33 33 * anchor - {Object} Object to which we'll anchor the popup. Must expose … … 37 37 * closeBoxCallback - {Function} Function to be called on closeBox click. 38 38 */ 39 initialize:function(id, lonlat, size, contentHTML, anchor, closeBox,39 initialize:function(id, lonlat, contentSize, contentHTML, anchor, closeBox, 40 40 closeBoxCallback) { 41 41 … … 82 82 * 83 83 * Parameters: 84 * size - {<OpenLayers.Size>} 84 * contentSize - {<OpenLayers.Size>} the new size for the popup's 85 * contents div (in pixels). 85 86 */ 86 setSize:function( size) {87 setSize:function(contentSize) { 87 88 OpenLayers.Popup.Anchored.prototype.setSize.apply(this, arguments); 88 89 trunk/openlayers/lib/OpenLayers/Popup/Framed.js
r6800 r7897 86 86 * id - {String} 87 87 * lonlat - {<OpenLayers.LonLat>} 88 * size - {<OpenLayers.Size>}88 * contentSize - {<OpenLayers.Size>} 89 89 * contentHTML - {String} 90 90 * anchor - {Object} Object to which we'll anchor the popup. Must expose … … 94 94 * closeBoxCallback - {Function} Function to be called on closeBox click. 95 95 */ 96 initialize:function(id, lonlat, size, contentHTML, anchor, closeBox,96 initialize:function(id, lonlat, contentSize, contentHTML, anchor, closeBox, 97 97 closeBoxCallback) { 98 98 … … 189 189 * 190 190 * Parameters: 191 * size - {<OpenLayers.Size>} 192 */ 193 setSize:function(size) { 191 * contentSize - {<OpenLayers.Size>} the new size for the popup's 192 * contents div (in pixels). 193 */ 194 setSize:function(contentSize) { 194 195 OpenLayers.Popup.Anchored.prototype.setSize.apply(this, arguments); 195 196 … … 297 298 } 298 299 299 if (this. relativePosition) {300 if (this.size && this.relativePosition) { 300 301 var position = this.positionBlocks[this.relativePosition]; 301 302 for (var i = 0; i < position.blocks.length; i++) { trunk/openlayers/lib/OpenLayers/Popup/FramedCloud.js
r7684 r7897 204 204 * id - {String} 205 205 * lonlat - {<OpenLayers.LonLat>} 206 * size - {<OpenLayers.Size>}206 * contentSize - {<OpenLayers.Size>} 207 207 * contentHTML - {String} 208 208 * anchor - {Object} Object to which we'll anchor the popup. Must expose … … 212 212 * closeBoxCallback - {Function} Function to be called on closeBox click. 213 213 */ 214 initialize:function(id, lonlat, size, contentHTML, anchor, closeBox,214 initialize:function(id, lonlat, contentSize, contentHTML, anchor, closeBox, 215 215 closeBoxCallback) { 216 216
