func (c Canvas) calculateSelectedUsedTiles(minX, maxX, minY, maxY int) map[tile.ID]tileSelection {
	switch {
	case maxX < c.draw.usedMin.x,
		c.draw.usedMin.x+c.draw.numCols*c.draw.tileLength <= minX,
		maxY < c.draw.usedMin.y,
		c.draw.usedMin.y+c.draw.numRows*c.draw.tileLength <= minY:
		return make(map[tile.ID]tileSelection)
	}
	minCol := tile.X((minX - c.draw.usedMin.x) / c.draw.tileLength)
	maxCol := tile.X((maxX - c.draw.usedMin.x) / c.draw.tileLength)
	minRow := tile.Y((minY - c.draw.usedMin.y) / c.draw.tileLength)
	maxRow := tile.Y((maxY - c.draw.usedMin.y) / c.draw.tileLength)
	tileIds := make(map[tile.ID]tileSelection)
	for col, yUsedTileLocs := range c.board.UsedTileLocs {
		if minCol <= col && col <= maxCol {
			for row, t := range yUsedTileLocs {
				if minRow <= row && row <= maxRow {
					tileIds[t.ID] = tileSelection{
						used: true,
						tile: t,
						x:    col,
						y:    row,
					}
				}
			}
		}
	}
	return tileIds
}
// calculateSelectedUsedTiles determines which used tiles are selected from the selection.
calculateSelectedUsedTiles determines which used tiles are selected from the selection.
// calculateSelectedUsedTiles determines which used tiles are selected from the selection .
func (c Canvas) calculateSelectedUsedTiles(minX, maxX, minY, maxY int) map[tile.ID]tileSelection {
	switch {
	case maxX < c.draw.usedMin.x,
		c.draw.usedMin.x+c.draw.numCols*c.draw.tileLength <= minX,
		maxY < c.draw.usedMin.y,
		c.draw.usedMin.y+c.draw.numRows*c.draw.tileLength <= minY:
		return make(map[tile.ID]tileSelection)
	}
	minCol := tile.X((minX - c.draw.usedMin.x) / c.draw.tileLength)
	maxCol := tile.X((maxX - c.draw.usedMin.x) / c.draw.tileLength)
	minRow := tile.Y((minY - c.draw.usedMin.y) / c.draw.tileLength)
	maxRow := tile.Y((maxY - c.draw.usedMin.y) / c.draw.tileLength)
	tileIds := make(map[tile.ID]tileSelection)
	for col, yUsedTileLocs := range c.board.UsedTileLocs {
		if minCol <= col && col <= maxCol {
			for row, t := range yUsedTileLocs {
				if minRow <= row && row <= maxRow {
					tileIds[t.ID] = tileSelection{
						used: true,
						tile: t,
						x:    col,
						y:    row,
					}
				}
			}
		}
	}
	return tileIds
}
func ( c Canvas ) calculateSelectedUsedTiles ( minX , maxX , minY , maxY int ) map [ tile . ID ] tileSelection { switch { case maxX < c . draw . usedMin . x , c . draw . usedMin . x + c . draw . numCols * c . draw . tileLength <= minX , maxY < c . draw . usedMin . y , c . draw . usedMin . y + c . draw . numRows * c . draw . tileLength <= minY : return make ( map [ tile . ID ] tileSelection ) } minCol := tile . X ( ( minX - c . draw . usedMin . x ) / c . draw . tileLength ) maxCol := tile . X ( ( maxX - c . draw . usedMin . x ) / c . draw . tileLength ) minRow := tile . Y ( ( minY - c . draw . usedMin . y ) / c . draw . tileLength ) maxRow := tile . Y ( ( maxY - c . draw . usedMin . y ) / c . draw . tileLength ) tileIds := make ( map [ tile . ID ] tileSelection ) for col , yUsedTileLocs := range c . board . UsedTileLocs { if minCol <= col && col <= maxCol { for row , t := range yUsedTileLocs { if minRow <= row && row <= maxRow { tileIds [ t . ID ] = tileSelection { used : true , tile : t , x : col , y : row , } } } } } return tileIds }
calculateSelectedUsedTiles determines which used tiles are selected from the selection.
calculateSelectedUsedTiles determines which used tiles are selected from the selection .