* @private * @function transformMapCenter * @description 转换center。 * @param {Object} mapInfoCenter - 中心点。 * @param {string} baseProjection - 坐标投影。 * @returns {Array}
(mapInfoCenter, sourceProjection)
| 114 | * @returns {Array} |
| 115 | */ |
| 116 | function transformMapCenter(mapInfoCenter, sourceProjection) { |
| 117 | let center = mapInfoCenter; |
| 118 | if (sourceProjection === 'EPSG:3857') { |
| 119 | return proj4(sourceProjection, 'EPSG:4326', mapInfoCenter); |
| 120 | } |
| 121 | if (sourceProjection !== 'EPSG:4326') { |
| 122 | return mapboxgl.proj4(sourceProjection, 'EPSG:4326', mapInfoCenter); |
| 123 | } |
| 124 | return center; |
| 125 | } |
| 126 | |
| 127 | /** |
| 128 | * @private |