This commit is contained in:
Лаврёнов Антон
2014-03-03 19:24:00 +08:00
parent e5db9115a0
commit a524ba9ec1
2 changed files with 25 additions and 1 deletions

View File

@@ -43,7 +43,7 @@
// call super constructor
Kinetic.Node.call(this, config);
this.on('shadowColorChange.kinetic shadowBlurChange.kinetic shadowOffsetChange.kinetic shadowOpacityChange.kinetic shadowEnabledChanged.kinetic', _clearHasShadowCache);
this.on('shadowColorChange.kinetic shadowBlurChange.kinetic shadowOffsetChange.kinetic shadowOpacityChange.kinetic shadowEnabledChange.kinetic', _clearHasShadowCache);
},
hasChildren: function() {
return false;

View File

@@ -182,6 +182,30 @@ suite('Node', function() {
});
// ======================================================
test('has shadow', function() {
var stage = addStage();
var layer = new Kinetic.Layer();
var rect = new Kinetic.Rect({
x: 10,
y: stage.getHeight() / 3,
width: 100,
height: 100,
fill : "red",
stroke: 'black',
strokeWidth: 4,
draggable: true
});
layer.add(rect);
stage.add(layer);
rect.shadowEnabled(true);
rect.shadowColor("grey");
assert.equal(rect.hasShadow(), true);
rect.shadowEnabled(false);
assert.equal(rect.hasShadow(), false);
});
// ======================================================
test('opacity cache', function() {
var stage = addStage();