onMoveCamera method
Implementation
Future<void> onMoveCamera(Rect rectCamera) {
if (!_isVisible || _quadTree == null) {
return Future.value();
}
_lastRectCamera = rectCamera;
List<Tile> visibleTiles = _quadTree!.query(
rectCamera.getRectangleByTileSize(_tileSize),
);
final tilesToAdd = visibleTiles.where((element) {
return !_visibleSet.contains(element.id);
}).toList();
_visibleSet = visibleTiles.map((e) => e.id).toSet();
removeWhere((tile) => !_visibleSet.contains((tile as TileComponent).id));
return addAll(_buildTiles(tilesToAdd));
}