Browse Source

Fixed: Context2d setters with invalid values ignored

v1.x
Tj Holowaychuk 13 years ago
parent
commit
f866dd8883
  1. 4
      lib/context2d.js

4
lib/context2d.js

@ -165,6 +165,7 @@ Context2d.prototype.setTransform = function(){
*/
Context2d.prototype.__defineSetter__('fillStyle', function(val){
if (!val) return;
if ('CanvasGradient' == val.constructor.name
|| 'CanvasPattern' == val.constructor.name) {
this.lastFillStyle = val;
@ -192,6 +193,7 @@ Context2d.prototype.__defineGetter__('fillStyle', function(){
*/
Context2d.prototype.__defineSetter__('strokeStyle', function(val){
if (!val) return;
if ('CanvasGradient' == val.constructor.name
|| 'CanvasPattern' == val.constructor.name) {
this.lastStrokeStyle = val;
@ -221,6 +223,7 @@ Context2d.prototype.__defineGetter__('strokeStyle', function(){
*/
Context2d.prototype.__defineSetter__('font', function(val){
if (!val) return;
if ('string' == typeof val) {
var font;
if (font = parseFont(val)) {
@ -252,6 +255,7 @@ Context2d.prototype.__defineGetter__('font', function(){
*/
Context2d.prototype.__defineSetter__('textBaseline', function(val){
if (!val) return;
var n = baselines.indexOf(val);
if (~n) {
this.lastBaseline = val;

Loading…
Cancel
Save