MCPcopy Create free account
hub / github.com/Maps4HTML/MapML.js / zoomTo

Method zoomTo

src/map-extent.js:123–137  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

121 }
122
123 zoomTo() {
124 let extent = this.extent;
125 let map = this.getMapEl()._map,
126 xmin = extent.topLeft.pcrs.horizontal,
127 xmax = extent.bottomRight.pcrs.horizontal,
128 ymin = extent.bottomRight.pcrs.vertical,
129 ymax = extent.topLeft.pcrs.vertical,
130 bounds = Lbounds(Lpoint(xmin, ymin), Lpoint(xmax, ymax)),
131 center = map.options.crs.unproject(bounds.getCenter(true)),
132 maxZoom = extent.zoom.maxZoom,
133 minZoom = extent.zoom.minZoom;
134 map.setView(center, Util.getMaxZoom(bounds, map, minZoom, maxZoom), {
135 animate: false
136 });
137 }
138
139 getMapEl() {
140 return Util.getClosest(this, 'mapml-viewer,map[is=web-map]');

Callers

nothing calls this directly

Calls 1

getMapElMethod · 0.95

Tested by

no test coverage detected