blob: df83753eebf5dd03d32f4b3ee2033f567fe7722f [file] [log] [blame]
function ICompElement(data,parentContainer,globalData,comp, placeholder){
this._parent.constructor.call(this,data,parentContainer,globalData,comp, placeholder);
this.layers = data.layers;
this.supports3d = true;
this.completeLayers = false;
this.pendingElements = [];
this.elements = this.layers ? Array.apply(null,{length:this.layers.length}) : [];
if(this.data.tm){
this.tm = PropertyFactory.getProp(this,this.data.tm,0,globalData.frameRate,this.dynamicProperties);
}
if(this.data.xt){
this.layerElement = document.createElementNS(svgNS,'g');
this.buildAllItems();
} else if(!globalData.progressiveLoad){
this.buildAllItems();
}
}
createElement(SVGBaseElement, ICompElement);
ICompElement.prototype.hide = function(){
if(!this.hidden){
var i,len = this.elements.length;
for( i = 0; i < len; i+=1 ){
if(this.elements[i]){
this.elements[i].hide();
}
}
this.hidden = true;
}
};
ICompElement.prototype.prepareFrame = function(num){
this._parent.prepareFrame.call(this,num);
if(this.isVisible===false && !this.data.xt){
return;
}
if(this.tm){
var timeRemapped = this.tm.v;
if(timeRemapped === this.data.op){
timeRemapped = this.data.op - 1;
}
this.renderedFrame = timeRemapped;
} else {
this.renderedFrame = num/this.data.sr;
}
var i,len = this.elements.length;
if(!this.completeLayers){
this.checkLayers(this.renderedFrame);
}
for( i = 0; i < len; i+=1 ){
if(this.completeLayers || this.elements[i]){
this.elements[i].prepareFrame(this.renderedFrame - this.layers[i].st);
}
}
};
ICompElement.prototype.renderFrame = function(parentMatrix){
var renderParent = this._parent.renderFrame.call(this,parentMatrix);
var i,len = this.layers.length;
if(renderParent===false){
this.hide();
return;
}
this.hidden = false;
for( i = 0; i < len; i+=1 ){
if(this.completeLayers || this.elements[i]){
this.elements[i].renderFrame();
}
}
if(this.firstFrame){
this.firstFrame = false;
}
};
ICompElement.prototype.setElements = function(elems){
this.elements = elems;
};
ICompElement.prototype.getElements = function(){
return this.elements;
};
ICompElement.prototype.destroy = function(){
this._parent.destroy.call(this._parent);
var i,len = this.layers.length;
for( i = 0; i < len; i+=1 ){
if(this.elements[i]){
this.elements[i].destroy();
}
}
};
ICompElement.prototype.checkLayers = SVGRenderer.prototype.checkLayers;
ICompElement.prototype.buildItem = SVGRenderer.prototype.buildItem;
ICompElement.prototype.buildAllItems = SVGRenderer.prototype.buildAllItems;
ICompElement.prototype.buildElementParenting = SVGRenderer.prototype.buildElementParenting;
ICompElement.prototype.createItem = SVGRenderer.prototype.createItem;
ICompElement.prototype.createImage = SVGRenderer.prototype.createImage;
ICompElement.prototype.createComp = SVGRenderer.prototype.createComp;
ICompElement.prototype.createSolid = SVGRenderer.prototype.createSolid;
ICompElement.prototype.createShape = SVGRenderer.prototype.createShape;
ICompElement.prototype.createText = SVGRenderer.prototype.createText;
ICompElement.prototype.createBase = SVGRenderer.prototype.createBase;
ICompElement.prototype.appendElementInPos = SVGRenderer.prototype.appendElementInPos;
ICompElement.prototype.checkPendingElements = SVGRenderer.prototype.checkPendingElements;
ICompElement.prototype.addPendingElement = SVGRenderer.prototype.addPendingElement;