mirror of
https://github.com/konvajs/konva.git
synced 2025-09-18 18:27:58 +08:00
fixed #769
This commit is contained in:
@@ -971,7 +971,11 @@
|
||||
val = attrs[key];
|
||||
if (!type._isFunction(val) && !type._isElement(val) && !(type._isObject(val) && type._hasMethods(val))) {
|
||||
getter = this[GET + Kinetic.Util._capitalize(key)];
|
||||
defaultValue = getter ? getter.call({attrs: {}}) : null;
|
||||
// remove attr value so that we can extract the default value from the getter
|
||||
delete attrs[key];
|
||||
defaultValue = getter ? getter.call(this) : null;
|
||||
// restore attr value
|
||||
attrs[key] = val;
|
||||
if (defaultValue !== val) {
|
||||
obj.attrs[key] = val;
|
||||
}
|
||||
|
@@ -3158,4 +3158,32 @@ suite('Node', function() {
|
||||
showHit(layer);
|
||||
|
||||
});
|
||||
|
||||
test('stage.toObject() when stage contains an image', function(done){
|
||||
var imageObj = new Image();
|
||||
imageObj.onload = function() {
|
||||
var stage = addStage();
|
||||
|
||||
var layer = new Kinetic.Layer();
|
||||
darth = new Kinetic.Image({
|
||||
x: 200,
|
||||
y: 60,
|
||||
image: imageObj,
|
||||
width: 100,
|
||||
height: 100,
|
||||
offset: {x: 50, y: 30},
|
||||
crop: {x: 135, y: 7, width: 167, height: 134},
|
||||
draggable: true
|
||||
});
|
||||
|
||||
layer.add(darth);
|
||||
stage.add(layer);
|
||||
|
||||
assert.equal(stage.toObject().className, 'Stage');
|
||||
|
||||
done();
|
||||
|
||||
};
|
||||
imageObj.src = 'assets/darth-vader.jpg';
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user