different values for corner radius. fix #687

This commit is contained in:
Anton Lavrenov
2019-07-12 17:12:11 +07:00
parent f3a30784f8
commit 477a2392ac
6 changed files with 96 additions and 42 deletions

View File

@@ -19,7 +19,7 @@ suite('Context', function() {
'arc',
'arcTo',
'rect',
'ellipse'
'ellipse',
'fill',
'stroke',
'clip',

View File

@@ -201,4 +201,28 @@ suite('Rect', function() {
context.fill();
compareLayerAndCanvas(layer, canvas, 100);
});
// ======================================================
test('array for corner radius', function() {
var stage = addStage();
var layer = new Konva.Layer();
var rect = new Konva.Rect({
x: 50,
y: 50,
width: 100,
height: 100,
fill: 'black',
cornerRadius: [0, 10, 20, 30]
});
layer.add(rect);
stage.add(layer);
layer.draw();
var trace = layer.getContext().getTrace();
assert.equal(
trace,
'clearRect(0,0,578,200);save();transform(1,0,0,1,50,50);beginPath();moveTo(0,0);lineTo(90,0);arc(90,10,10,4.712,0,false);lineTo(100,80);arc(80,80,20,0,1.571,false);lineTo(30,100);arc(30,70,30,1.571,3.142,false);lineTo(0,0);arc(0,0,0,3.142,4.712,false);closePath();fillStyle=black;fill();restore();clearRect(0,0,578,200);save();transform(1,0,0,1,50,50);beginPath();moveTo(0,0);lineTo(90,0);arc(90,10,10,4.712,0,false);lineTo(100,80);arc(80,80,20,0,1.571,false);lineTo(30,100);arc(30,70,30,1.571,3.142,false);lineTo(0,0);arc(0,0,0,3.142,4.712,false);closePath();fillStyle=black;fill();restore();'
);
});
});