calculateSpan method

int calculateSpan(
  1. VectorDefinition start,
  2. CellMergeDirection direction
)

Implementation

int calculateSpan(VectorDefinition start, CellMergeDirection direction) {
  var current = start;
  for (var span = 1; span < maxMergeSpan; span++) {
    current = direction == CellMergeDirection.horizontal
        ? VectorDefinition(current.x + 1, current.y)
        : VectorDefinition(current.x, current.y + 1);
    final cell = cells[current];
    final strategy = cell?.merge;
    if (strategy is! MergedCellStrategy || strategy.direction != direction) {
      return span;
    }
  }
  return maxMergeSpan;
}