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

@@ -370,6 +370,16 @@ export class Shape<Config extends ShapeConfig = ShapeConfig> extends Node<
// this.getStrokeRadialGradientColorStops()
);
}
hasHitStroke() {
const width = this.hitStrokeWidth();
// we should enable hit stroke we stroke is enabled
// and we have some value from width
return (
this.strokeEnabled() &&
(width || this.strokeWidth() && width === 'auto')
);
}
/**
* determines if point is in the shape, regardless if other shapes are on top of it. Note: because
* this method clears a temporary canvas and then redraws the shape, it performs very poorly if executed many times