func (c Canvas) calculateSelectedUnusedTiles(minX, maxX, minY, maxY int) map[tile.ID]tileSelection {
	switch {
	case maxX < c.draw.unusedMin.x,
		c.draw.unusedMin.x+len(c.board.UnusedTileIDs)*c.draw.tileLength <= minX,
		maxY < c.draw.unusedMin.y,
		c.draw.unusedMin.y+c.draw.tileLength <= minY:
		return make(map[tile.ID]tileSelection)
	}
	minI := (minX - c.draw.unusedMin.x) / c.draw.tileLength
	if minI < 0 {
		minI = 0
	}
	maxI := (maxX - c.draw.unusedMin.x) / c.draw.tileLength
	if maxI >= len(c.board.UnusedTileIDs) {
		maxI = len(c.board.UnusedTileIDs) - 1
	}
	tiles := make(map[tile.ID]tileSelection)
	for i, id := range c.board.UnusedTileIDs[minI : maxI+1] {
		t := c.board.UnusedTiles[id]
		tiles[id] = tileSelection{
			used:  false,
			tile:  t,
			index: minI + i,
		}
	}
	return tiles
}
// calculateSelectedUnusedTiles determines which unused tiles are selected from the selection.
calculateSelectedUnusedTiles determines which unused tiles are selected from the selection.
// calculateSelectedUnusedTiles determines which unused tiles are selected from the selection .
func (c Canvas) calculateSelectedUnusedTiles(minX, maxX, minY, maxY int) map[tile.ID]tileSelection {
	switch {
	case maxX < c.draw.unusedMin.x,
		c.draw.unusedMin.x+len(c.board.UnusedTileIDs)*c.draw.tileLength <= minX,
		maxY < c.draw.unusedMin.y,
		c.draw.unusedMin.y+c.draw.tileLength <= minY:
		return make(map[tile.ID]tileSelection)
	}
	minI := (minX - c.draw.unusedMin.x) / c.draw.tileLength
	if minI < 0 {
		minI = 0
	}
	maxI := (maxX - c.draw.unusedMin.x) / c.draw.tileLength
	if maxI >= len(c.board.UnusedTileIDs) {
		maxI = len(c.board.UnusedTileIDs) - 1
	}
	tiles := make(map[tile.ID]tileSelection)
	for i, id := range c.board.UnusedTileIDs[minI : maxI+1] {
		t := c.board.UnusedTiles[id]
		tiles[id] = tileSelection{
			used:  false,
			tile:  t,
			index: minI + i,
		}
	}
	return tiles
}
func ( c Canvas ) calculateSelectedUnusedTiles ( minX , maxX , minY , maxY int ) map [ tile . ID ] tileSelection { switch { case maxX < c . draw . unusedMin . x , c . draw . unusedMin . x + len ( c . board . UnusedTileIDs ) * c . draw . tileLength <= minX , maxY < c . draw . unusedMin . y , c . draw . unusedMin . y + c . draw . tileLength <= minY : return make ( map [ tile . ID ] tileSelection ) } minI := ( minX - c . draw . unusedMin . x ) / c . draw . tileLength if minI < 0 { minI = 0 } maxI := ( maxX - c . draw . unusedMin . x ) / c . draw . tileLength if maxI >= len ( c . board . UnusedTileIDs ) { maxI = len ( c . board . UnusedTileIDs ) - 1 } tiles := make ( map [ tile . ID ] tileSelection ) for i , id := range c . board . UnusedTileIDs [ minI : maxI + 1 ] { t := c . board . UnusedTiles [ id ] tiles [ id ] = tileSelection { used : false , tile : t , index : minI + i , } } return tiles }
calculateSelectedUnusedTiles determines which unused tiles are selected from the selection.
calculateSelectedUnusedTiles determines which unused tiles are selected from the selection .