[OpenLayers-Commits] r3149 - in trunk/openlayers: doc examples lib/OpenLayers lib/OpenLayers/Popup tests
commits at openlayers.org
commits at openlayers.org
Tue May 15 17:10:14 EDT 2007
Author: crschmidt
Date: 2007-05-15 17:10:13 -0400 (Tue, 15 May 2007)
New Revision: 3149
Modified:
trunk/openlayers/doc/authors.txt
trunk/openlayers/examples/popups.html
trunk/openlayers/lib/OpenLayers/Feature.js
trunk/openlayers/lib/OpenLayers/Popup.js
trunk/openlayers/lib/OpenLayers/Popup/AnchoredBubble.js
trunk/openlayers/tests/test_Popup.html
Log:
Apply patch from John Cole to make closeBox show up in AnchoredBubble
popups. (Thanks John!) I like this solution better than hacking Rico.
Closes #698.
Modified: trunk/openlayers/doc/authors.txt
===================================================================
--- trunk/openlayers/doc/authors.txt 2007-05-13 15:52:49 UTC (rev 3148)
+++ trunk/openlayers/doc/authors.txt 2007-05-15 21:10:13 UTC (rev 3149)
@@ -1,6 +1,7 @@
OpenLayers contributors:
Howard Butler
Bertil Chaupis
+John Cole
Jeff Dege
Schuyler Erle
Christian López Espínola
Modified: trunk/openlayers/examples/popups.html
===================================================================
--- trunk/openlayers/examples/popups.html 2007-05-13 15:52:49 UTC (rev 3148)
+++ trunk/openlayers/examples/popups.html 2007-05-15 21:10:13 UTC (rev 3149)
@@ -47,7 +47,7 @@
popup = new OpenLayers.Popup.Anchored("chicken",
new OpenLayers.LonLat(5,40),
new OpenLayers.Size(200,200),
- "example popup");
+ "example popup", true);
map.addPopup(popup);
}
@@ -69,8 +69,17 @@
}
function mousedown(evt) {
+ // check to see if the popup was hidden by the close box
+ // if so, then destroy it before continuing
+ if (popup != null) {
+ if (!popup.visible()) {
+ markers.map.removePopup(popup);
+ popup.destroy();
+ popup = null;
+ }
+ }
if (popup == null) {
- popup = feature.createPopup();
+ popup = feature.createPopup(true);
popup.setContentHTML("<a href='http://www.somethingconstructive.net' target='_blank'>click me</a>");
popup.setBackgroundColor("yellow");
popup.setOpacity(0.7);
Modified: trunk/openlayers/lib/OpenLayers/Feature.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Feature.js 2007-05-13 15:52:49 UTC (rev 3148)
+++ trunk/openlayers/lib/OpenLayers/Feature.js 2007-05-15 21:10:13 UTC (rev 3149)
@@ -121,6 +121,7 @@
},
/**
+ * @param {Boolean} closeBox create popup with closebox or not
* @returns A Popup Object created from the 'lonlat', 'popupSize',
* and 'popupContentHTML' properties set in this.data. It uses
* this.marker.icon as default anchor.
@@ -132,7 +133,7 @@
*
* @type OpenLayers.Popup.AnchoredBubble
*/
- createPopup: function() {
+ createPopup: function(closeBox) {
if (this.lonlat != null) {
@@ -143,7 +144,7 @@
this.lonlat,
this.data.popupSize,
this.data.popupContentHTML,
- anchor);
+ anchor, closeBox);
}
return this.popup;
},
Modified: trunk/openlayers/lib/OpenLayers/Popup/AnchoredBubble.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Popup/AnchoredBubble.js 2007-05-13 15:52:49 UTC (rev 3148)
+++ trunk/openlayers/lib/OpenLayers/Popup/AnchoredBubble.js 2007-05-15 21:10:13 UTC (rev 3149)
@@ -139,7 +139,7 @@
if (firstTime) {
OpenLayers.Rico.Corner.round(this.div, options);
} else {
- OpenLayers.Rico.Corner.reRound(this.contentDiv, options);
+ OpenLayers.Rico.Corner.reRound(this.groupDiv, options);
//set the popup color and opacity
this.setBackgroundColor();
this.setOpacity();
Modified: trunk/openlayers/lib/OpenLayers/Popup.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Popup.js 2007-05-13 15:52:49 UTC (rev 3148)
+++ trunk/openlayers/lib/OpenLayers/Popup.js 2007-05-15 21:10:13 UTC (rev 3149)
@@ -45,6 +45,9 @@
/** @type DOMElement */
contentDiv:null,
+
+ /** @type DOMElement */
+ groupDiv:null,
/** @type int */
padding: 5,
@@ -84,13 +87,18 @@
this.div = OpenLayers.Util.createDiv(this.id, null, null,
null, null, null, "hidden");
this.div.className = 'olPopup';
+
+ this.groupDiv = OpenLayers.Util.createDiv(null, null, null,
+ null, "relative", null,
+ "hidden");
var id = this.div.id + "_contentDiv";
this.contentDiv = OpenLayers.Util.createDiv(id, null, this.size.clone(),
null, "relative", null,
"hidden");
this.contentDiv.className = 'olPopupContent';
- this.div.appendChild(this.contentDiv);
+ this.groupDiv.appendChild(this.contentDiv);
+ this.div.appendChild(this.groupDiv);
if (closeBox == true) {
// close icon
@@ -102,7 +110,7 @@
img);
closeImg.style.right = this.padding + "px";
closeImg.style.top = this.padding + "px";
- this.div.appendChild(closeImg);
+ this.groupDiv.appendChild(closeImg);
var closePopup = function(e) {
this.hide();
Modified: trunk/openlayers/tests/test_Popup.html
===================================================================
--- trunk/openlayers/tests/test_Popup.html 2007-05-13 15:52:49 UTC (rev 3148)
+++ trunk/openlayers/tests/test_Popup.html 2007-05-15 21:10:13 UTC (rev 3149)
@@ -80,7 +80,7 @@
t.eq(popup.div.style.width, w + "px", "width position of popup.div set correctly");
t.eq(popup.div.style.height, h + "px", "heightposition of popup.div set correctly");
- var contentDiv = popup.div.childNodes[0];
+ var contentDiv = popup.div.childNodes[0].childNodes[0];
t.eq(contentDiv.className, "olPopupContent", "correct content div className");
t.eq(contentDiv.id, "chicken_contentDiv", "correct content div id");
More information about the Commits
mailing list