take data in Marker's constructor, and if it has a valid data and the data has a valid loadEvents() function, then call it

git-svn-id: http://svn.openlayers.org/trunk/openlayers@370 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-05-25 18:00:38 +00:00
parent 53e919b45b
commit baf1259064
+7 -1
View File
@@ -29,15 +29,21 @@ OpenLayers.Marker.prototype = {
* @param {OpenLayers.Icon} icon * @param {OpenLayers.Icon} icon
* @param {OpenLayers.LonLat lonlat * @param {OpenLayers.LonLat lonlat
*/ */
initialize: function(lonlat, icon) { initialize: function(lonlat, icon, data) {
this.icon = icon; this.icon = icon;
this.lonlat = lonlat; this.lonlat = lonlat;
this.data = data;
this.image = OpenLayers.Util.createImage(this.icon.url, this.image = OpenLayers.Util.createImage(this.icon.url,
this.icon.size, this.icon.size,
null, null,
"absolute" "absolute"
); );
this.events = new OpenLayers.Events(this, this.image, null); this.events = new OpenLayers.Events(this, this.image, null);
//load marker events from data
if (this.data != null && this.data.loadEvents != null) {
this.data.loadEvents(marker);
}
}, },
/** /**