hitTest method

GDisplayObject? hitTest(
  1. GPoint localPoint, [
  2. bool useShape = false
])

Determines if this object overlaps with the given localPoint.

If useShape is true, the object will be tested against its shape rather than its bounding box. Defaults to false.

Implementation

GDisplayObject? hitTest(GPoint localPoint, [bool useShape = false]) {
  if (!$hasTouchableArea || !mouseEnabled) {
    return null;
  }
  if (($mask != null || maskRect != null) && !hitTestMask(localPoint)) {
    return null;
  }
  if (getBounds(this, _sHelperRect)!.containsPoint(localPoint)) {
    return this;
  }
  return null;
}