mirror of
https://github.com/konvajs/konva.git
synced 2025-09-19 02:37:59 +08:00
Merge branch 'e98cuenc-fix-fill-open-path'
This commit is contained in:
@@ -85,12 +85,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (closedPath) {
|
context.fillStrokeShape(this);
|
||||||
context.fillStrokeShape(this);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
context.strokeShape(this);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
getSelfRect: function() {
|
getSelfRect: function() {
|
||||||
var points = [];
|
var points = [];
|
||||||
|
@@ -827,16 +827,17 @@ suite('Path', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ======================================================
|
// ======================================================
|
||||||
test('Stroke only when no fill', function() {
|
test('Stroke and fill when no closed', function() {
|
||||||
|
|
||||||
// https://github.com/ericdrowell/KonvaJS/issues/567
|
// https://github.com/konvajs/konva/issues/150
|
||||||
|
|
||||||
var stage = addStage();
|
var stage = addStage();
|
||||||
var layer = new Konva.Layer();
|
var layer = new Konva.Layer();
|
||||||
|
|
||||||
var path = new Konva.Path({
|
var path = new Konva.Path({
|
||||||
data: "M 50 0 C 50 150 170 170 200 170",
|
data: "M 50 0 C 50 150 170 170 200 170",
|
||||||
stroke: 'black'
|
stroke: 'black',
|
||||||
|
fill: '#ff0000'
|
||||||
});
|
});
|
||||||
|
|
||||||
// override color key so that we can test the context trace
|
// override color key so that we can test the context trace
|
||||||
@@ -865,8 +866,8 @@ suite('Path', function() {
|
|||||||
var hitTrace = layer.hitCanvas.getContext().getTrace();
|
var hitTrace = layer.hitCanvas.getContext().getTrace();
|
||||||
//console.log(hitTrace);
|
//console.log(hitTrace);
|
||||||
|
|
||||||
assert.equal(trace, 'clearRect(0,0,578,200);save();transform(1,0,0,1,0,0);beginPath();moveTo(50,0);bezierCurveTo(50,150,170,170,200,170);lineWidth=2;strokeStyle=black;stroke();restore();');
|
assert.equal(trace, 'clearRect(0,0,578,200);save();transform(1,0,0,1,0,0);beginPath();moveTo(50,0);bezierCurveTo(50,150,170,170,200,170);fillStyle=#ff0000;fill();lineWidth=2;strokeStyle=black;stroke();restore();');
|
||||||
assert.equal(hitTrace, 'clearRect(0,0,578,200);save();transform(1,0,0,1,0,0);beginPath();moveTo(50,0);bezierCurveTo(50,150,170,170,200,170);lineWidth=2;strokeStyle=black;stroke();restore();');
|
assert.equal(hitTrace, 'clearRect(0,0,578,200);save();transform(1,0,0,1,0,0);beginPath();moveTo(50,0);bezierCurveTo(50,150,170,170,200,170);save();fillStyle=black;fill();restore();lineWidth=2;strokeStyle=black;stroke();restore();');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('getClientRect', function() {
|
it('getClientRect', function() {
|
||||||
|
Reference in New Issue
Block a user