allow hitStrokeWidth usage, even if a shape has not stroke visible. fix #782

This commit is contained in:
Anton Lavrenov
2019-11-08 11:37:10 -05:00
parent 713c3d71c4
commit bb68b3f1a8
6 changed files with 53 additions and 7 deletions

View File

@@ -1122,6 +1122,31 @@ suite('Shape', function() {
// );
});
test('enable hitStrokeWidth even if we have no stroke on scene', function() {
var stage = addStage();
var layer = new Konva.Layer();
var rect = new Konva.Rect({
x: 10,
y: 10,
width: 100,
height: 100
});
// default value
layer.add(rect);
stage.add(layer);
// try to hit test near edge
assert.equal(stage.getIntersection({ x: 5, y: 5 }), null);
rect.hitStrokeWidth(20);
layer.draw();
// no we should hit the rect
assert.equal(stage.getIntersection({ x: 5, y: 5 }), rect);
});
test('cache shadow color rgba', function() {
var circle = new Konva.Circle({
fill: 'green',