TolonUK/Leaflet.EdgeBuffer

GridLayers with tileSize of type Point are not supported

Closed this issue · 2 comments

Hi,

According to the leaflet docs, the tileSize option can be either a Number or a Point.
In case it is a Point, the function _getTiledPixelBounds() is broken an returns NaN.

The fix is to adapt the computation of the pixel bounds as stated below:

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));
}

The prototype function getTileSize() always returns a point from the value set on the options and takes care to convert a scalar to a Point.

If you need me to create a quick pull request, just drop me a line.

Regards,
Hauke

Thanks, I hadn't tested that use case. Please put together a pull request, that way you get the credit. :)

I just added the pull request. Let me know, if anything is missing.