mirror of
https://github.com/konvajs/konva.git
synced 2025-12-21 19:27:08 +08:00
rewrote shadow logic. fill and strokes are now both taken into account. shape and shadow opacities now work well together
This commit is contained in:
@@ -31,7 +31,7 @@ suite('Rect', function(){
|
||||
});
|
||||
|
||||
// ======================================================
|
||||
test('add rect with shadow, rotation, corner radius, and opacity', function(){
|
||||
test('add rect with shadow, corner radius, and opacity', function(){
|
||||
var stage = addStage();
|
||||
|
||||
var layer = new Kinetic.Layer();
|
||||
@@ -63,8 +63,8 @@ suite('Rect', function(){
|
||||
assert.equal(rect.getCornerRadius(), 5);
|
||||
|
||||
var trace = layer.getContext().getTrace();
|
||||
//console.log(layer.getContext().traceArr);
|
||||
assert.equal(trace, 'clearRect(0,0,578,200);save();globalAlpha=0.4;transform(1,0,0,1,100,50);beginPath();moveTo(5,0);lineTo(95,0);arc(95,5,5,4.712,0,false);lineTo(100,45);arc(95,45,5,0,1.571,false);lineTo(5,50);arc(5,45,5,1.571,3.142,false);lineTo(0,5);arc(5,5,5,3.142,4.712,false);closePath();save();globalAlpha=0.2;shadowColor=red;shadowBlur=10;shadowOffsetX=5;shadowOffsetY=5;fillStyle=green;fill();restore();fillStyle=green;fill();lineWidth=2;strokeStyle=blue;stroke();restore();');
|
||||
//console.log(trace);
|
||||
assert.equal(trace, 'clearRect(0,0,578,200);save();save();globalAlpha=0.2;shadowColor=red;shadowBlur=10;shadowOffsetX=5;shadowOffsetY=5;drawImage([object HTMLCanvasElement],0,0);restore();globalAlpha=0.4;drawImage([object HTMLCanvasElement],0,0);restore();');
|
||||
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user