Closed lcnvdl closed 10 years ago
Using a minifier, I've detected the next problem:
iio.Text.prototype.right = function () { this.ctx.save(); this.ctx.font = this.font; if (this.textAlign == 'center') return this.pos.x + this.ctx.measureText(this.text).width / 2; else if (this.textAlign == 'right' || this.textAlign == 'end') return this.pos.x; else return this.pos.x + this.ctx.measureText(this.text).width; this.ctx.restore(); // HERE: This will never be executed } iio.Text.prototype.left = function () { this.ctx.save(); this.ctx.font = this.font; if (this.textAlign == 'center') return this.pos.x - this.ctx.measureText(this.text).width / 2; else if (this.textAlign == 'right' || this.textAlign == 'end') return this.pos.x - this.ctx.measureText(this.text).width; else return this.pos.x; this.ctx.restore(); // HERE: This will never be executed }
Solution:
iio.Text.prototype.right = function () { var result; this.ctx.save(); this.ctx.font = this.font; if (this.textAlign == 'center') result = this.pos.x + this.ctx.measureText(this.text).width / 2; else if (this.textAlign == 'right' || this.textAlign == 'end') result = this.pos.x; else result = this.pos.x + this.ctx.measureText(this.text).width; this.ctx.restore(); return result; } iio.Text.prototype.left = function () { var result; this.ctx.save(); this.ctx.font = this.font; if (this.textAlign == 'center') result = this.pos.x - this.ctx.measureText(this.text).width / 2; else if (this.textAlign == 'right' || this.textAlign == 'end') result = this.pos.x - this.ctx.measureText(this.text).width; else result = this.pos.x; this.ctx.restore(); return result; }
Thanks for catching this, your solution has been integrated into 1.2
Using a minifier, I've detected the next problem:
Solution: