allow for custom popup class on a feature. (Closes #947)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@4128 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2007-08-30 17:17:58 +00:00
parent be4180fd75
commit 64c41835fa
3 changed files with 84 additions and 9 deletions

View File

@@ -85,9 +85,6 @@
"OpenLayers/Marker/Box.js",
"OpenLayers/Popup.js",
"OpenLayers/Tile.js",
"OpenLayers/Feature.js",
"OpenLayers/Feature/Vector.js",
"OpenLayers/Feature/WFS.js",
"OpenLayers/Tile/Image.js",
"OpenLayers/Tile/WFS.js",
"OpenLayers/Layer/Image.js",
@@ -113,6 +110,9 @@
"OpenLayers/Layer/TileCache.js",
"OpenLayers/Popup/Anchored.js",
"OpenLayers/Popup/AnchoredBubble.js",
"OpenLayers/Feature.js",
"OpenLayers/Feature/Vector.js",
"OpenLayers/Feature/WFS.js",
"OpenLayers/Handler.js",
"OpenLayers/Handler/Point.js",
"OpenLayers/Handler/Path.js",

View File

@@ -6,6 +6,7 @@
/**
* @requires OpenLayers/Util.js
* @requires OpenLayers/Marker.js
* @requires OpenLayers/Popup/AnchoredBubble.js
*
* Class: OpenLayers.Feature
* Features are combinations of geography and attributes. The OpenLayers.Feature
@@ -43,6 +44,13 @@ OpenLayers.Feature = OpenLayers.Class({
*/
marker: null,
/**
* APIProperty: popupClass
* {<OpenLayers.Class>} The class which will be used to instantiate
* a new Popup. Default is <OpenLayers.Popup.AnchoredBubble>.
*/
popupClass: OpenLayers.Popup.AnchoredBubble,
/**
* Property: popup
* {<OpenLayers.Popup>}
@@ -168,11 +176,12 @@ OpenLayers.Feature = OpenLayers.Class({
var id = this.id + "_popup";
var anchor = (this.marker) ? this.marker.icon : null;
this.popup = new OpenLayers.Popup.AnchoredBubble(id,
this.lonlat,
this.data.popupSize,
this.data.popupContentHTML,
anchor, closeBox);
this.popup = new this.popupClass(id,
this.lonlat,
this.data.popupSize,
this.data.popupContentHTML,
anchor,
closeBox);
}
return this.popup;
},