blob: f51de21db8e409380b850e60368dd45de33baf9e [file] [log] [blame]
function IImageElement(data, animationItem,parentContainer){
this.animationItem = animationItem;
this.assets = this.animationItem.getAssets();
this.path = this.animationItem.getPath();
this.parent.constructor.call(this,data, animationItem,parentContainer);
}
createElement(BaseElement, IImageElement);
IImageElement.prototype.createElements = function(){
var self = this;
var imageLoaded = function(){
self.image.setAttributeNS('http://www.w3.org/1999/xlink','href',self.path+self.assets[self.data.assetId].path);
self.maskedElement = self.image;
self.animationItem.elementLoaded();
};
var img = new Image();
img.addEventListener('load', imageLoaded, false);
img.src = this.path+this.assets[this.data.assetId].path;
this.parent.createElements.call(this);
this.image = document.createElementNS(svgNS,'image');
this.image.setAttribute('width',this.data.width+"px");
this.image.setAttribute('height',this.data.height+"px");
this.layerElement.appendChild(this.image);
this.maskingGroup = this.image;
styleUnselectableDiv(this.image);
};