Merge pull request #1427 from asturur/shadow-return-null

Update shadow.class.js - `objects.setShadow(null)` removes the sahdow
Closes #1422
This commit is contained in:
Stefan Kienzle 2014-06-24 15:48:16 +02:00
commit 50e3fd717c
3 changed files with 7 additions and 1 deletions

View file

@ -64,6 +64,7 @@
* @return {fabric.Shadow} thisArg
*/
initialize: function(options) {
if (typeof options === 'string') {
options = this._parseShadow(options);
}

View file

@ -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);
},
/**

View file

@ -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() {