From 79d035d27e80978fc79e735cf4be1006663955bf Mon Sep 17 00:00:00 2001 From: asturur Date: Tue, 24 Jun 2014 13:16:42 +0200 Subject: [PATCH 1/5] Update shadow.class.js Shadow return null if null is passed. Makes .setShadow(null) works. --- src/shadow.class.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/shadow.class.js b/src/shadow.class.js index 47ac4d5e..9172c08f 100644 --- a/src/shadow.class.js +++ b/src/shadow.class.js @@ -64,6 +64,10 @@ * @return {fabric.Shadow} thisArg */ initialize: function(options) { + if (!options) { + return null; + } + if (typeof options === 'string') { options = this._parseShadow(options); } From 62d281bd3d6a5da905194bf7a77103d89f765c1a Mon Sep 17 00:00:00 2001 From: asturur Date: Tue, 24 Jun 2014 14:12:39 +0200 Subject: [PATCH 2/5] Update object.js I'm not sure, i'm sorry i tried to guess. --- test/unit/object.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/unit/object.js b/test/unit/object.js index b8f79e49..8cf87cf2 100644 --- a/test/unit/object.js +++ b/test/unit/object.js @@ -1075,6 +1075,11 @@ test('toDataURL & reference to canvas', function() { equal(object.shadow.blur, 10); equal(object.shadow.offsetX, 5); equal(object.shadow.offsetY, 15); + + equal(object.setShadow(null),object,'should be chainable'); + ok(!(object.shadow instanceof fabric.Shadow)); + equal(object.shadow, null); + }); test('set shadow', function() { From a95897313fe9578762923a84390261c1d2a392b0 Mon Sep 17 00:00:00 2001 From: asturur Date: Tue, 24 Jun 2014 15:34:18 +0200 Subject: [PATCH 3/5] Update object.js i need bigger spacebar. or better i need to stick something on comma key that press even space after it. Something that can bend down in one direction but not in the other, so when i press comma it push spacebar down, and when i press spacebar i don't fire a comma! --- test/unit/object.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/object.js b/test/unit/object.js index 8cf87cf2..984a55c4 100644 --- a/test/unit/object.js +++ b/test/unit/object.js @@ -1076,7 +1076,7 @@ test('toDataURL & reference to canvas', function() { equal(object.shadow.offsetX, 5); equal(object.shadow.offsetY, 15); - equal(object.setShadow(null),object,'should be chainable'); + equal(object.setShadow(null), object, 'should be chainable'); ok(!(object.shadow instanceof fabric.Shadow)); equal(object.shadow, null); From 22b0149e49121b0acde2dd317980ea4e0973016c Mon Sep 17 00:00:00 2001 From: asturur Date: Tue, 24 Jun 2014 15:38:14 +0200 Subject: [PATCH 4/5] Update object.class.js as suggested by Kienz. --- src/shapes/object.class.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shapes/object.class.js b/src/shapes/object.class.js index a2cf787f..cb732056 100644 --- a/src/shapes/object.class.js +++ b/src/shapes/object.class.js @@ -1304,7 +1304,7 @@ * canvas.renderAll(); */ setShadow: function(options) { - return this.set('shadow', new fabric.Shadow(options)); + return this.set('shadow', options ? new fabric.Shadow(options) : null); }, /** From 12c2fb82c37264307350c3c9ca5ea48025bde97d Mon Sep 17 00:00:00 2001 From: asturur Date: Tue, 24 Jun 2014 15:39:31 +0200 Subject: [PATCH 5/5] Update shadow.class.js At the end was a bad idea. If we call new fabric.Shadow() we should get a shadow whatever we pass as an argument. --- src/shadow.class.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/shadow.class.js b/src/shadow.class.js index 9172c08f..7731f0ef 100644 --- a/src/shadow.class.js +++ b/src/shadow.class.js @@ -64,10 +64,7 @@ * @return {fabric.Shadow} thisArg */ initialize: function(options) { - if (!options) { - return null; - } - + if (typeof options === 'string') { options = this._parseShadow(options); }