Merge pull request #2204 from asturur/fixtextstylec

Add a bool to force cache clear on next render
This commit is contained in:
Juriy Zaytsev 2015-05-18 11:54:44 -04:00
commit 37720eaeab
4 changed files with 7 additions and 4 deletions

View file

@ -582,7 +582,7 @@
}
this.styles[lineIndex + 1] = newLineStyles;
}
this._clearCache();
this._forceClearCache = true;
},
/**
@ -612,7 +612,7 @@
this.styles[lineIndex][charIndex] =
style || clone(currentLineStyles[charIndex - 1]);
this._clearCache();
this._forceClearCache = true;
},
/**

View file

@ -579,7 +579,6 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
this._removeExtraneousStyles();
this._clearCache();
this.canvas && this.canvas.renderAll();
this.setCoords();

View file

@ -283,7 +283,7 @@
}
}
/* not included in _extendStyles to avoid clearing cache more than once */
this._clearCache();
this._forceClearCache = true;
return this;
},

View file

@ -682,6 +682,10 @@
*/
_shouldClearCache: function() {
var shouldClear = false;
if (this._forceClearCache) {
this._forceClearCache = false;
return true;
}
for (var prop in this._dimensionAffectingProps) {
if (this['__' + prop] !== this[prop]) {
this['__' + prop] = this[prop];