hitTestInput method

  1. @override
DisplayObject? hitTestInput(
  1. num localX,
  2. num localY
)
override

Evaluates this display object to see if the coordinates localX and localY are inside this display object.

If the coordinates are inside, this display object is returned; null otherwise.

localX and localY are relative to to the origin (0,0) of this display object (local coordinates).

Implementation

@override
DisplayObject? hitTestInput(num localX, num localY) {
  if (_viewportRectangle == null) {
    return super.hitTestInput(localX, localY);
  } else if (_viewportMask!.hitTest(localX, localY)) {
    final x = localX + _viewportRectangle!.left;
    final y = localY + _viewportRectangle!.top;
    return super.hitTestInput(x, y);
  } else {
    return null;
  }
}