| 151 | : null; |
| 152 | } |
| 153 | zoomTo() { |
| 154 | let extent = this.extent; |
| 155 | if (!extent) return; |
| 156 | let map = this.getMapEl()._map, |
| 157 | xmin = extent.topLeft.pcrs.horizontal, |
| 158 | xmax = extent.bottomRight.pcrs.horizontal, |
| 159 | ymin = extent.bottomRight.pcrs.vertical, |
| 160 | ymax = extent.topLeft.pcrs.vertical, |
| 161 | newBounds = bounds(point(xmin, ymin), point(xmax, ymax)), |
| 162 | center = map.options.crs.unproject(newBounds.getCenter(true)), |
| 163 | maxZoom = extent.zoom.maxZoom, |
| 164 | minZoom = extent.zoom.minZoom; |
| 165 | map.setView(center, Util.getMaxZoom(newBounds, map, minZoom, maxZoom), { |
| 166 | animate: false |
| 167 | }); |
| 168 | } |
| 169 | getMapEl() { |
| 170 | return Util.getClosest(this, 'mapml-viewer,map[is=web-map]'); |
| 171 | } |