23 lines
773 B
JavaScript
23 lines
773 B
JavaScript
export default function (L) {
|
|
L.EdgeBuffer = {
|
|
previousMethods: {
|
|
getTiledPixelBounds: L.GridLayer.prototype._getTiledPixelBounds,
|
|
}
|
|
};
|
|
|
|
L.GridLayer.include({
|
|
_getTiledPixelBounds: function (center, zoom, tileZoom) {
|
|
var pixelBounds = L.EdgeBuffer.previousMethods.getTiledPixelBounds.call(this, center, zoom, tileZoom);
|
|
|
|
var edgeBufferTiles = this.options.edgeBufferTiles ?? 1;
|
|
if (edgeBufferTiles > 0) {
|
|
var pixelEdgeBuffer = L.GridLayer.prototype.getTileSize.call(this).multiplyBy(edgeBufferTiles);
|
|
pixelBounds = new L.Bounds(pixelBounds.min.subtract(pixelEdgeBuffer), pixelBounds.max.add(pixelEdgeBuffer));
|
|
}
|
|
return pixelBounds;
|
|
}
|
|
});
|
|
|
|
return L;
|
|
}
|
|
|