()
| 552 | }; |
| 553 | } |
| 554 | getZoomToZoom() { |
| 555 | let tL = this.extent.topLeft.pcrs, |
| 556 | bR = this.extent.bottomRight.pcrs, |
| 557 | bound = bounds( |
| 558 | point(tL.horizontal, tL.vertical), |
| 559 | point(bR.horizontal, bR.vertical) |
| 560 | ); |
| 561 | let projection = this.getMapEl()._map.options.projection, |
| 562 | layerZoomBounds = this.getLayerEl().extent.zoom, |
| 563 | minZoom = layerZoomBounds.minZoom ? layerZoomBounds.minZoom : 0, |
| 564 | maxZoom = layerZoomBounds.maxZoom |
| 565 | ? layerZoomBounds.maxZoom |
| 566 | : M[projection].options.resolutions.length - 1; |
| 567 | let newZoom; |
| 568 | if (this.hasAttribute('zoom')) { |
| 569 | // if there is a zoom attribute set to the map-feature, zoom to the zoom attribute value |
| 570 | newZoom = this.zoom; |
| 571 | } else { |
| 572 | // if not, calculate the maximum zoom level that can show the feature completely |
| 573 | newZoom = Util.getMaxZoom(bound, this.getMapEl()._map, minZoom, maxZoom); |
| 574 | if (this.max < newZoom) { |
| 575 | // if the calculated zoom is greater than the value of max zoom attribute, go with max zoom attribute |
| 576 | newZoom = this.max; |
| 577 | } else if (this.min > newZoom) { |
| 578 | // if the calculated zoom is less than the value of min zoom attribute, go with min zoom attribute |
| 579 | newZoom = this.min; |
| 580 | } |
| 581 | } |
| 582 | // prevent overzooming / underzooming |
| 583 | if (newZoom < minZoom) { |
| 584 | newZoom = minZoom; |
| 585 | } else if (newZoom > maxZoom) { |
| 586 | newZoom = maxZoom; |
| 587 | } |
| 588 | |
| 589 | // should check whether the extent after zooming falls into the templated extent bound |
| 590 | return newZoom; |
| 591 | } |
| 592 | getMeta(metaName) { |
| 593 | let name = metaName.toLowerCase(); |
| 594 | if (name !== 'cs' && name !== 'zoom' && name !== 'projection') return; |
no test coverage detected