From 17080848ba0db6e9e668958dc6bc7399bd580a0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sko=CC=88ld?= Date: Tue, 17 Jan 2012 15:54:53 +0100 Subject: [PATCH] Check for both CanvasGradient and CanvasPattern in ctx.strokeStyle and ctx.fillStyle. --- lib/context2d.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/context2d.js b/lib/context2d.js index 7941b7e..05403c4 100644 --- a/lib/context2d.js +++ b/lib/context2d.js @@ -165,7 +165,7 @@ Context2d.prototype.setTransform = function(){ */ Context2d.prototype.__defineSetter__('fillStyle', function(val){ - if ('CanvasGradient' == val.constructor.name) { + if (~['CanvasGradient','CanvasPattern'].indexOf(val.constructor.name)) { this.lastFillStyle = val; this._setFillPattern(val); } else if ('string' == typeof val) { @@ -191,7 +191,7 @@ Context2d.prototype.__defineGetter__('fillStyle', function(){ */ Context2d.prototype.__defineSetter__('strokeStyle', function(val){ - if ('CanvasGradient' == val.constructor.name) { + if (~['CanvasGradient','CanvasPattern'].indexOf(val.constructor.name)) { this.lastStrokeStyle = val; this._setStrokePattern(val); } else if ('string' == typeof val) {