isVisible property

  1. @override
bool isVisible
override

Param checks if this component is visible on the screen

Implementation

@override
bool get isVisible {
  if (!hasGameRef) return false;
  if (!gameRef.hasLayout) return false;
  if (lightingConfig == null) return super.isVisible;

  Rect rectLight = Rect.fromLTWH(
    this.position.rect.center.dx -
        (lightingConfig!.radius + lightingConfig!.blurBorder / 2),
    this.position.rect.center.dy -
        (lightingConfig!.radius + lightingConfig!.blurBorder / 2),
    (lightingConfig!.radius * 2) + lightingConfig!.blurBorder,
    (lightingConfig!.radius * 2) + lightingConfig!.blurBorder,
  );

  return gameRef.camera.isRectOnCamera(rectLight);
}
void isVisible=(bool _isVisible)
inherited

Param checks if this component is visible on the screen

Implementation

bool isVisible = false;