Changeset 7684
- Timestamp:
- 08/03/08 14:47:52 (4 months ago)
- Files:
-
- trunk/openlayers/lib/OpenLayers/Popup.js (modified) (5 diffs)
- trunk/openlayers/lib/OpenLayers/Popup/FramedCloud.js (modified) (2 diffs)
- trunk/openlayers/lib/OpenLayers/Util.js (modified) (2 diffs)
- trunk/openlayers/tests/manual/rendered-dimensions.html (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/lib/OpenLayers/Popup.js
r7656 r7684 118 118 119 119 /** 120 * Property: displayClass 121 * {String} The CSS class of the popup. 122 */ 123 displayClass: "olPopup", 124 125 /** 126 * Property: contentDisplayClass 127 * {String} The CSS class of the popup content div. 128 */ 129 contentDisplayClass: "olPopupContent", 130 131 /** 120 132 * Property: padding 121 133 * {int or <OpenLayers.Bounds>} An extra opportunity to specify internal … … 199 211 this.div = OpenLayers.Util.createDiv(this.id, null, null, 200 212 null, null, null, "hidden"); 201 this.div.className = 'olPopup';213 this.div.className = this.displayClass; 202 214 203 215 var groupDivId = this.id + "_GroupDiv"; … … 209 221 this.contentDiv = OpenLayers.Util.createDiv(id, null, this.size.clone(), 210 222 null, "relative"); 211 this.contentDiv.className = 'olPopupContent';223 this.contentDiv.className = this.contentDisplayClass; 212 224 this.groupDiv.appendChild(this.contentDiv); 213 225 this.div.appendChild(this.groupDiv); … … 499 511 */ 500 512 setContentHTML:function(contentHTML) { 513 514 var preparedHTML; 501 515 if (contentHTML != null) { 502 516 this.contentHTML = contentHTML; 503 517 } 504 518 505 519 if (this.autoSize) { 506 520 //fake the contentDiv for the CSS context 521 preparedHTML = "<div class='" + this.contentDisplayClass+ "'>" + this.contentHTML + "<div>"; 522 507 523 // determine actual render dimensions of the contents 508 524 var realSize = 509 OpenLayers.Util.getRenderedDimensions(this.contentHTML); 525 OpenLayers.Util.getRenderedDimensions(preparedHTML, null, 526 { displayClass: this.displayClass }); 510 527 511 528 // is the "real" size of the div is safe to display in our map? … … 536 553 // run getRenderedDimensions() again with a fixed dimension 537 554 var clippedSize = OpenLayers.Util.getRenderedDimensions( 538 this.contentHTML, fixedSize 555 preparedHTML, fixedSize, 556 { displayClass: this.contentDisplayClass } 539 557 ); 540 558 trunk/openlayers/lib/OpenLayers/Popup/FramedCloud.js
r6751 r7684 16 16 OpenLayers.Popup.FramedCloud = 17 17 OpenLayers.Class(OpenLayers.Popup.Framed, { 18 19 /** 20 * Property: contentDisplayClass 21 * {String} The CSS class of the popup content div. 22 */ 23 contentDisplayClass: "olFramedCloudPopupContent", 18 24 19 25 /** … … 211 217 this.imageSrc = OpenLayers.Util.getImagesLocation() + 'cloud-popup-relative.png'; 212 218 OpenLayers.Popup.Framed.prototype.initialize.apply(this, arguments); 213 this.contentDiv.className = "olFramedCloudPopupContent";219 this.contentDiv.className = this.contentDisplayClass; 214 220 }, 215 221 trunk/openlayers/lib/OpenLayers/Util.js
r7675 r7684 1375 1375 * 1376 1376 * Parameters: 1377 * contentHTML 1377 1378 * size - {<OpenLayers.Size>} If either the 'w' or 'h' properties is 1378 1379 * specified, we fix that dimension of the div to be measured. This is 1379 1380 * useful in the case where we have a limit in one dimension and must 1380 1381 * therefore meaure the flow in the other dimension. 1382 * options - {Object} 1383 * displayClass - {String} Optional parameter. A CSS class name(s) string 1384 * to provide the CSS context of the rendered content. 1381 1385 * 1382 1386 * Returns: 1383 1387 * {OpenLayers.Size} 1384 1388 */ 1385 OpenLayers.Util.getRenderedDimensions = function(contentHTML, size ) {1389 OpenLayers.Util.getRenderedDimensions = function(contentHTML, size, options) { 1386 1390 1387 1391 var w, h; … … 1403 1407 } 1404 1408 } 1409 1410 //add css classes, if specified 1411 if (options && options.displayClass) { 1412 container.className = options.displayClass; 1413 } 1405 1414 1406 1415 // create temp content div and assign content
