diff --git a/src/gradient.class.js b/src/gradient.class.js index 49a8a863..47f8a904 100644 --- a/src/gradient.class.js +++ b/src/gradient.class.js @@ -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); diff --git a/src/shapes/text.class.js b/src/shapes/text.class.js index de3b20c4..6b77f490 100644 --- a/src/shapes/text.class.js +++ b/src/shapes/text.class.js @@ -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); + this[shortM].toLive && ctx.restore(); }, /** @@ -540,7 +552,7 @@ var lineHeights = 0; - if (!this.shadow.affectStroke) { + if (this.shadow && !this.shadow.affectStroke) { this._removeShadow(ctx); }