Update text.class.js

This commit is contained in:
Andrea Bogazzi 2015-05-09 09:42:16 +02:00 committed by asturur
parent b214818cad
commit 323c648961
2 changed files with 13 additions and 12 deletions

View file

@ -258,17 +258,6 @@
}
}
if (object.type === 'text' || object.type === 'i-text') {
for (prop in coords) {
if (prop === 'x1' || prop === 'x2') {
coords[prop] -= object.width / 2;
}
else if (prop === 'y1' || prop === 'y2') {
coords[prop] -= object.height / 2;
}
}
}
if (this.type === 'linear') {
gradient = ctx.createLinearGradient(
coords.x1, coords.y1, coords.x2, coords.y2);

View file

@ -434,7 +434,19 @@
* @param {Number} top Top position of text
*/
_renderChars: function(method, ctx, chars, left, top) {
// remove Text word from method var
var shortM = method.slice(0, -4);
if (this[shortM].toLive) {
var offsetX = -this.width / 2 + this[shortM].offsetX || 0,
offsetY = -this.height / 2 + this[shortM].offsetY || 0;
ctx.save();
ctx.translate(offsetX, offsetY);
left -= offsetX;
top -= offsetY;
}
console.log(ctx.strokeStyle);
ctx[method](chars, left, top);
(offsetX || offsetY) && ctx.restore();
},
/**
@ -540,7 +552,7 @@
var lineHeights = 0;
if (!this.shadow.affectStroke) {
if (this.shadow && !this.shadow.affectStroke) {
this._removeShadow(ctx);
}