computeDrawRect method

Rectangle<num> computeDrawRect(
  1. Tile tile
)

Implementation

Rectangle computeDrawRect(Tile tile) {
  final image = tile.image;
  if (image != null) {
    return Rectangle(
      0,
      0,
      image.width!.toDouble(),
      image.height!.toDouble(),
    );
  }
  final row = tile.localId ~/ columns!;
  final column = tile.localId % columns!;
  final x = margin + (column * (tileWidth! + spacing));
  final y = margin + (row * (tileHeight! + spacing));
  return Rectangle(
    x.toDouble(),
    y.toDouble(),
    tileWidth!.toDouble(),
    tileHeight!.toDouble(),
  );
}