hitTestInput method

  1. @override
DisplayObject hitTestInput (num localX 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) {
  var hitArea = this.hitArea;
  var graphics = _graphics;
  DisplayObject target;

  if (hitArea != null) {
    var point = Point<num>(localX, localY);
    this.localToGlobal(point, point);
    hitArea.globalToLocal(point, point);
    target = hitArea.hitTestInput(point.x, point.y);
    return target != null ? this : null;
  }

  target = super.hitTestInput(localX, localY);

  if (target == null && graphics != null) {
    target = graphics.hitTest(localX, localY) ? this : null;
  }

  return target;
}