protected isHit(
context: IInputModeContext,
location: Point,
label: ILabel
): boolean {
const labelLayout = label.layout
if (labelLayout.hits(location, context.hitTestRadius)) {
return true
}
const layoutTransform = LabelStyleBase.createLayoutTransform(
context.canvasComponent!.createRenderContext(),
labelLayout,
true
)
layoutTransform.invert()
const transformedLocation = layoutTransform
.transform(location)
.subtract(new Point(labelLayout.width * 0.5, labelLayout.height))
const tailBounds = new Rect(0, 0, tailWidth, tailHeight)
if (
!tailBounds.containsWithEps(transformedLocation, context.hitTestRadius)
) {
return false
}
const tailHeightAtLocationX =
tailHeight * ((tailWidth - transformedLocation.x) / tailWidth)
return (
transformedLocation.y <= tailHeightAtLocationX + context.hitTestRadius
)
}