blob: 73d8b7eceb306bf4c7143970021ee0a85f025723 [file] [log] [blame]
function ITextElement(){
}
ITextElement.prototype.initElement = function(data,globalData,comp){
this.lettersChangedFlag = true;
this.initFrame();
this.initBaseData(data, globalData, comp);
this.textAnimator = new TextAnimatorProperty(data.t, this.renderType, this);
this.textProperty = new TextProperty(this, data.t, this.dynamicProperties);
this.initTransform(data, globalData, comp);
this.initHierarchy();
this.initRenderable();
this.initRendererElement();
this.createContainerElements();
this.addMasks();
this.createContent();
this.hide();
this.textAnimator.searchProperties(this.dynamicProperties);
};
ITextElement.prototype.prepareFrame = function(num) {
this._mdf = false;
this.prepareRenderableFrame(num);
this.prepareProperties(num, this.isInRange);
if(this.textProperty._mdf || this.textProperty._isFirstFrame) {
this.buildNewText();
this.textProperty._isFirstFrame = false;
}
};
ITextElement.prototype.createPathShape = function(matrixHelper, shapes) {
var j,jLen = shapes.length;
var k, kLen, pathNodes;
var shapeStr = '';
for(j=0;j<jLen;j+=1){
pathNodes = shapes[j].ks.k;
shapeStr += this.buildShapeString(pathNodes, pathNodes.i.length, true, matrixHelper);
}
return shapeStr;
};
ITextElement.prototype.updateDocumentData = function(newData, index) {
this.textProperty.updateDocumentData(newData, index);
this.buildNewText();
this.renderInnerContent();
};
ITextElement.prototype.canResizeFont = function(_canResize) {
this.textProperty.canResizeFont(_canResize);
this.buildNewText();
this.renderInnerContent();
};
ITextElement.prototype.setMinimumFontSize = function(_fontSize) {
this.textProperty.setMinimumFontSize(_fontSize);
this.buildNewText();
this.renderInnerContent();
};
ITextElement.prototype.applyTextPropertiesToMatrix = function(documentData, matrixHelper, lineNumber, xPos, yPos) {
if(documentData.ps){
matrixHelper.translate(documentData.ps[0],documentData.ps[1] + documentData.ascent,0);
}
matrixHelper.translate(0,-documentData.ls,0);
switch(documentData.j){
case 1:
matrixHelper.translate(documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[lineNumber]),0,0);
break;
case 2:
matrixHelper.translate(documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[lineNumber] )/2,0,0);
break;
}
matrixHelper.translate(xPos, yPos, 0);
};
ITextElement.prototype.buildColor = function(colorData) {
return 'rgb(' + Math.round(colorData[0]*255) + ',' + Math.round(colorData[1]*255) + ',' + Math.round(colorData[2]*255) + ')';
};
ITextElement.prototype.buildShapeString = IShapeElement.prototype.buildShapeString;
ITextElement.prototype.emptyProp = new LetterProps();
ITextElement.prototype.destroy = function(){
};