onPaper method

void onPaper(
  1. double widthPx,
  2. double heightPx
)

A partitura ganhou a caixa widthPx x heightPx: se mudou e a rodada está parada ou começou, ela se redesenha.

Implementation

void onPaper(double widthPx, double heightPx) {
  if ((_loadWidthPx == widthPx && _loadHeightPx == heightPx) ||
      state.running ||
      listen.state.listening ||
      state.result != null) {
    return;
  }
  _loadWidthPx = widthPx;
  _loadHeightPx = heightPx;
  // Parada à vista, a mesma partitura se redesenha na nova largura.
  if (state.startedRound) {
    unawaited(novaRodada(widthPx, repeat: idle && source.canRepeatRound));
  }
}