()
| 273 | } |
| 274 | } |
| 275 | _calculateExtent() { |
| 276 | const mapEl = this.getMapEl(); |
| 277 | |
| 278 | if (!mapEl || !mapEl._map) { |
| 279 | // Can't calculate extent without a map |
| 280 | return; |
| 281 | } |
| 282 | |
| 283 | const map = mapEl._map; |
| 284 | const projection = map.options.projection; |
| 285 | const tileSize = M[projection].options.crs.tile.bounds.max.x; |
| 286 | |
| 287 | // Convert tile coordinates to pixel bounds |
| 288 | const pixelX = this.col * tileSize; |
| 289 | const pixelY = this.row * tileSize; |
| 290 | const pixelBounds = Lbounds( |
| 291 | Lpoint(pixelX, pixelY), |
| 292 | Lpoint(pixelX + tileSize, pixelY + tileSize) |
| 293 | ); |
| 294 | |
| 295 | // Convert pixel bounds to PCRS bounds |
| 296 | const pcrsBounds = Util.pixelToPCRSBounds( |
| 297 | pixelBounds, |
| 298 | this.zoom, |
| 299 | projection |
| 300 | ); |
| 301 | |
| 302 | // Format the extent similar to feature extents |
| 303 | this._extent = Util._convertAndFormatPCRS( |
| 304 | pcrsBounds, |
| 305 | map.options.crs, |
| 306 | projection |
| 307 | ); |
| 308 | |
| 309 | // Add zoom information |
| 310 | this._extent.zoom = { |
| 311 | minZoom: this.zoom, |
| 312 | maxZoom: this.zoom, |
| 313 | minNativeZoom: this.zoom, |
| 314 | maxNativeZoom: this.zoom |
| 315 | }; |
| 316 | } |
| 317 | } |
no test coverage detected