Nullify cssString cache when color/alpha values change.

This commit is contained in:
Jonathan Puckey 2011-02-19 18:01:08 +01:00
parent 8d570d0834
commit 57b7b364bc
3 changed files with 3 additions and 0 deletions

View file

@ -14,6 +14,7 @@ Color = Base.extend({
else if (this._alpha < 0) this._alpha = 0; else if (this._alpha < 0) this._alpha = 0;
else if (alpha > 1) this._alpha = 1; else if (alpha > 1) this._alpha = 1;
else this._alpha = alpha; else this._alpha = alpha;
this._cssString = null;
}, },
/** /**

View file

@ -82,6 +82,7 @@ GrayColor = Color.extend({
return 1 - this._gray; return 1 - this._gray;
}; };
fields['set' + key.capitalize()] = function(value) { fields['set' + key.capitalize()] = function(value) {
this._cssString = null;
this._gray = this._gray * (1 - weight) + weight * (1 - value); this._gray = this._gray * (1 - weight) + weight * (1 - value);
}; };
}); });

View file

@ -156,6 +156,7 @@ RGBColor = Color.extend(new function() {
}, },
setGray: function(gray) { setGray: function(gray) {
this._cssString = null;
this._red = this._green = this._blue = gray; this._red = this._green = this._blue = gray;
}, },