| function IImageElement(data,parentContainer,globalData,comp,placeholder){ |
| this.assetData = globalData.getAssetData(data.refId); |
| this._parent.constructor.call(this,data,parentContainer,globalData,comp,placeholder); |
| } |
| createElement(SVGBaseElement, IImageElement); |
| |
| IImageElement.prototype.createElements = function(){ |
| |
| var assetPath = this.globalData.getAssetsPath(this.assetData); |
| |
| this._parent.createElements.call(this); |
| |
| this.innerElem = document.createElementNS(svgNS,'image'); |
| this.innerElem.setAttribute('width',this.assetData.w+"px"); |
| this.innerElem.setAttribute('height',this.assetData.h+"px"); |
| this.innerElem.setAttribute('preserveAspectRatio','xMidYMid slice'); |
| this.innerElem.setAttributeNS('http://www.w3.org/1999/xlink','href',assetPath); |
| this.maskedElement = this.innerElem; |
| this.layerElement.appendChild(this.innerElem); |
| if(this.data.ln){ |
| this.layerElement.setAttribute('id',this.data.ln); |
| } |
| if(this.data.cl){ |
| this.layerElement.setAttribute('class',this.data.cl); |
| } |
| |
| }; |
| |
| IImageElement.prototype.hide = function(){ |
| if(!this.hidden){ |
| this.layerElement.style.display = 'none'; |
| this.hidden = true; |
| } |
| }; |
| |
| IImageElement.prototype.renderFrame = function(parentMatrix){ |
| var renderParent = this._parent.renderFrame.call(this,parentMatrix); |
| if(renderParent===false){ |
| this.hide(); |
| return; |
| } |
| if(this.hidden){ |
| this.hidden = false; |
| this.layerElement.style.display = 'block'; |
| } |
| if(this.firstFrame){ |
| this.firstFrame = false; |
| } |
| }; |
| |
| IImageElement.prototype.destroy = function(){ |
| this._parent.destroy.call(); |
| this.innerElem = null; |
| }; |