TextLayer: Set height on each subline

This commit is contained in:
Julian Viereck 2011-01-09 20:50:47 +01:00
commit 46ecdc3b7c

View file

@ -149,7 +149,6 @@ var Text = function(parentEl) {
};
this.updateLines = function(config, firstRow, lastRow) {
console.log("layer.text.updateLines", firstRow, lastRow);
this.$computeTabString();
// Due to wrap line changes there can be new lines if e.g.
// the line to updated wrapped in the meantime.
@ -250,7 +249,6 @@ var Text = function(parentEl) {
};
this.update = function(config) {
console.log("layer.text.update()");
this.$computeTabString();
this.config = config;
@ -279,7 +277,6 @@ var Text = function(parentEl) {
};
this.$renderLine = function(stringBuilder, row, tokens) {
console.log("layer.text.renderLine", row);
// if (this.$showInvisibles) {
// var self = this;
// var spaceRe = /[\v\f \u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000]+/g;
@ -319,7 +316,9 @@ var Text = function(parentEl) {
splitChars = splits[0];
}
stringBuilder.push("<div>");
stringBuilder.push("<div style='height:",
this.config.lineHeight, "px",
"'>");
for (var i = 0; i < tokens.length; i++) {
var token = tokens[i];
var value = token.value;
@ -332,7 +331,10 @@ var Text = function(parentEl) {
addToken(token, value.substring(0, splitChars - chars));
value = value.substring(splitChars - chars);
chars = splitChars;
stringBuilder.push("</div><div>");
stringBuilder.push("</div>",
"<div style='height:",
this.config.lineHeight, "px",
"'>");
split ++;
splitChars = splits[split] || Number.MAX_VALUE;
}