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. git-svn-id: http://svn.openlayers.org/trunk/openlayers@3149 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -121,6 +121,7 @@ OpenLayers.Feature.prototype= {
|
||||
},
|
||||
|
||||
/**
|
||||
* @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 @@ OpenLayers.Feature.prototype= {
|
||||
*
|
||||
* @type OpenLayers.Popup.AnchoredBubble
|
||||
*/
|
||||
createPopup: function() {
|
||||
createPopup: function(closeBox) {
|
||||
|
||||
if (this.lonlat != null) {
|
||||
|
||||
@@ -143,7 +144,7 @@ OpenLayers.Feature.prototype= {
|
||||
this.lonlat,
|
||||
this.data.popupSize,
|
||||
this.data.popupContentHTML,
|
||||
anchor);
|
||||
anchor, closeBox);
|
||||
}
|
||||
return this.popup;
|
||||
},
|
||||
|
||||
@@ -45,6 +45,9 @@ OpenLayers.Popup.prototype = {
|
||||
|
||||
/** @type DOMElement */
|
||||
contentDiv:null,
|
||||
|
||||
/** @type DOMElement */
|
||||
groupDiv:null,
|
||||
|
||||
/** @type int */
|
||||
padding: 5,
|
||||
@@ -84,13 +87,18 @@ OpenLayers.Popup.prototype = {
|
||||
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 @@ OpenLayers.Popup.prototype = {
|
||||
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();
|
||||
|
||||
@@ -139,7 +139,7 @@ OpenLayers.Popup.AnchoredBubble.prototype =
|
||||
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();
|
||||
|
||||
Reference in New Issue
Block a user