(resolution, resolutions)
| 235 | * ``` |
| 236 | */ |
| 237 | export function getZoomByResolution(resolution, resolutions) { |
| 238 | let zoom = 0; |
| 239 | let minDistance; |
| 240 | for (let i = 0; i < resolutions.length; i++) { |
| 241 | if (i === 0) { |
| 242 | minDistance = Math.abs(resolution - resolutions[i]); |
| 243 | } |
| 244 | if (minDistance > Math.abs(resolution - resolutions[i])) { |
| 245 | minDistance = Math.abs(resolution - resolutions[i]); |
| 246 | zoom = i; |
| 247 | } |
| 248 | } |
| 249 | return zoom; |
| 250 | } |
| 251 | |
| 252 | /** |
| 253 | * @private |
no outgoing calls
no test coverage detected