mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-05-17 02:01:05 +00:00
Merge pull request #2568 from asturur/fix-shadow
Update shadow.class.js
This commit is contained in:
commit
ae1ee007a3
2 changed files with 17 additions and 13 deletions
|
|
@ -146,22 +146,18 @@
|
|||
color: this.color,
|
||||
blur: this.blur,
|
||||
offsetX: this.offsetX,
|
||||
offsetY: this.offsetY
|
||||
offsetY: this.offsetY,
|
||||
affectStroke: this.affectStroke
|
||||
};
|
||||
}
|
||||
var obj = { }, proto = fabric.Shadow.prototype;
|
||||
if (this.color !== proto.color) {
|
||||
obj.color = this.color;
|
||||
}
|
||||
if (this.blur !== proto.blur) {
|
||||
obj.blur = this.blur;
|
||||
}
|
||||
if (this.offsetX !== proto.offsetX) {
|
||||
obj.offsetX = this.offsetX;
|
||||
}
|
||||
if (this.offsetY !== proto.offsetY) {
|
||||
obj.offsetY = this.offsetY;
|
||||
}
|
||||
|
||||
['color', 'blur', 'offsetX', 'offsetY', 'affectStroke'].forEach(function(prop) {
|
||||
if (this[prop] !== proto[prop]) {
|
||||
obj[prop] = this[prop];
|
||||
}
|
||||
}, this);
|
||||
|
||||
return obj;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -135,6 +135,14 @@
|
|||
equal(JSON.stringify(object), '{"color":"rgb(0,0,0)","blur":0,"offsetX":0,"offsetY":0}');
|
||||
});
|
||||
|
||||
test('clone with affectStroke', function() {
|
||||
var shadow = new fabric.Shadow({affectStroke: true, blur: 5});
|
||||
ok(typeof shadow.toObject == 'function');
|
||||
var object = shadow.toObject(),
|
||||
shadow2 = new fabric.Shadow(object);
|
||||
deepEqual(shadow, shadow2);
|
||||
});
|
||||
|
||||
test('toObject without default value', function() {
|
||||
var shadow = new fabric.Shadow();
|
||||
shadow.includeDefaultValues = false;
|
||||
|
|
|
|||
Loading…
Reference in a new issue