MCPcopy Index your code
hub / github.com/Maps4HTML/MapML.js / zoomTo

Method zoomTo

src/layer.js:836–854  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

834 }
835
836 zoomTo() {
837 this.whenReady().then(() => {
838 let map = this.parentElement._map,
839 extent = this.extent,
840 tL = extent.topLeft.pcrs,
841 bR = extent.bottomRight.pcrs,
842 layerBounds = bounds(
843 point(tL.horizontal, tL.vertical),
844 point(bR.horizontal, bR.vertical)
845 ),
846 center = map.options.crs.unproject(layerBounds.getCenter(true));
847
848 let maxZoom = extent.zoom.maxZoom,
849 minZoom = extent.zoom.minZoom;
850 map.setView(center, Util.getMaxZoom(layerBounds, map, minZoom, maxZoom), {
851 animate: false
852 });
853 });
854 }
855 mapml2geojson(options = {}) {
856 return Util.mapml2geojson(this, options);
857 }

Calls 2

whenReadyMethod · 0.95
boundsFunction · 0.85

Tested by

no test coverage detected