Remove extent default so we catch errors when extent is not set

This commit is contained in:
ahocevar
2019-02-18 12:00:42 +01:00
parent 08be6cf9bc
commit 667cadc403
3 changed files with 4 additions and 11 deletions

View File

@@ -4,13 +4,6 @@
import Tile from './Tile.js';
import TileState from './TileState.js';
/**
* @const
* @type {import("./extent.js").Extent}
*/
const DEFAULT_EXTENT = [0, 0, 4096, 4096];
class VectorTile extends Tile {
/**
@@ -89,7 +82,7 @@ class VectorTile extends Tile {
* @api
*/
getExtent() {
return this.extent_ || DEFAULT_EXTENT;
return this.extent_;
}
/**
@@ -166,7 +159,7 @@ class VectorTile extends Tile {
* calculated by multiplying the tile size with the tile pixel ratio. For
* sources using {@link module:ol/format/MVT~MVT} as feature format, the
* {@link module:ol/format/MVT~MVT#getLastExtent} method will return the correct
* extent. The default is `[0, 0, 4096, 4096]`.
* extent.
* @param {import("./extent.js").Extent} extent The extent.
* @api
*/

View File

@@ -42,12 +42,11 @@ import {equals} from '../array.js';
* var data = // ... fetch data
* var format = tile.getFormat();
* tile.setProjection(format.readProjection(data));
* tile.setExtent(format.getLastExtent()); // line only required for ol/format/MVT
* tile.setFeatures(format.readFeatures(data, {
* // featureProjection is not required for ol/format/MVT
* featureProjection: map.getView().getProjection()
* }));
* // the line below is only required for ol/format/MVT
* tile.setExtent(format.getLastExtent());
* }
* });
* ```

View File

@@ -203,6 +203,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() {
let tile;
tileCallback = function(t) {
t.setProjection(proj);
t.setExtent([0, 0, 4096, 4096]);
tile = t;
};
map.renderSync();