(map: Map)
| 158 | } |
| 159 | |
| 160 | export function getProjection(map: Map): 'mercator' | 'globe' { |
| 161 | const projection = map.getProjection?.(); |
| 162 | const type = |
| 163 | // maplibre projection spec |
| 164 | projection?.type || |
| 165 | // mapbox projection spec |
| 166 | projection?.name; |
| 167 | if (type === 'globe') { |
| 168 | return 'globe'; |
| 169 | } |
| 170 | if (type && type !== 'mercator') { |
| 171 | throw new Error('Unsupported projection'); |
| 172 | } |
| 173 | return 'mercator'; |
| 174 | } |
| 175 | |
| 176 | export function getDefaultView(map: Map): GlobeView | MapView { |
| 177 | if (getProjection(map) === 'globe') { |
no test coverage detected
searching dependent graphs…