MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / _getResizedZoom

Method _getResizedZoom

src/common/mapping/WebMapBase.js:707–719  ·  view source on GitHub ↗
(bounds, mapContainerStyle, tileSize = 512, worldWidth = WORLD_WIDTH)

Source from the content-addressed store, hash-verified

705 }
706
707 _getResizedZoom(bounds, mapContainerStyle, tileSize = 512, worldWidth = WORLD_WIDTH) {
708 const { width, height } = mapContainerStyle;
709 const lngArcLength = Math.abs(bounds.getEast() - bounds.getWest());
710 const latArcLength = Math.abs(
711 this._getBoundsRadian(bounds.getSouth()) - this._getBoundsRadian(bounds.getNorth())
712 );
713 const lngResizeZoom = +Math.log2(worldWidth / ((lngArcLength / parseInt(width)) * tileSize)).toFixed(2);
714 const latResizeZoom = +Math.log2(worldWidth / ((latArcLength / parseInt(height)) * tileSize)).toFixed(2);
715 if (lngResizeZoom <= latResizeZoom) {
716 return lngResizeZoom;
717 }
718 return latResizeZoom;
719 }
720
721 _getBoundsRadian(point) {
722 return (180 / Math.PI) * Math.log(Math.tan(Math.PI / 4 + (point * Math.PI) / 360));

Callers 1

resizeMethod · 0.95

Calls 1

_getBoundsRadianMethod · 0.95

Tested by

no test coverage detected