Remove use of characterStyle / paragraphStyle where not necessary.

This commit is contained in:
Jürg Lehni 2011-06-20 18:53:36 +01:00
parent 0a877adba7
commit 318ed69ad2
3 changed files with 10 additions and 11 deletions

View file

@ -47,20 +47,20 @@
var segment = path.segments[i];
var text = new PointText(segment.point - [0, 10]);
text.content = i;
text.paragraphStyle.justification = 'center';
text.justification = 'center';
}
for (var i = 0; i < 2; i++) {
var handleInText = new PointText();
handleInText.content = 'handleIn';
handleInText.paragraphStyle.justification = 'center';
handleInText.characterStyle.fontSize = 9;
handleInText.justification = 'center';
handleInText.fontSize = 9;
handleTexts.push(handleInText);
var handleOutText = new PointText();
handleOutText.content = 'handleOut';
handleOutText.paragraphStyle.justification = 'center';
handleOutText.characterStyle.fontSize = 9;
handleOutText.justification = 'center';
handleOutText.fontSize = 9;
handleTexts.push(handleOutText);
}

View file

@ -148,7 +148,7 @@
? 8 : 0;
var text = new PointText(middle + awayVector.normalize(away + lengthSize));
text.rotate(textAngle);
text.paragraphStyle.justification = 'center';
text.justification = 'center';
value = value || vector.length;
text.content = (prefix || '') + Math.floor(value * 1000) / 1000;
text.fillColor = 'black';

View file

@ -25,8 +25,8 @@ var PointText = this.PointText = TextItem.extend({
*
* @example
* var text = new PointText(new Point(50, 100));
* text.paragraphStyle.justification = 'center';
* text.characterStyle.fillColor = 'black';
* text.justification = 'center';
* text.fillColor = 'black';
* text.content = 'The contents of the point text';
*
* @class A PointText item represents a piece of typography in your Paper.js
@ -86,9 +86,8 @@ var PointText = this.PointText = TextItem.extend({
if (!this._content)
return;
ctx.save();
ctx.font = this._characterStyle.fontSize + 'pt ' +
this._characterStyle.font;
ctx.textAlign = this._paragraphStyle.justification;
ctx.font = this.getFontSize() + 'pt ' + this.getFont();
ctx.textAlign = this.getJustification();
this._matrix.applyToContext(ctx);
var fillColor = this.getFillColor();