Skip to content

Instantly share code, notes, and snippets.

@cmulders
Created October 23, 2015 14:42
Show Gist options
  • Select an option

  • Save cmulders/acbbe8a8ff170e34c37b to your computer and use it in GitHub Desktop.

Select an option

Save cmulders/acbbe8a8ff170e34c37b to your computer and use it in GitHub Desktop.
Workaround for white lines between tiles in leaflet during fractional zooming (such as during fly-to and zooming animations)
/*
* Workaround for 1px lines appearing in some browsers due to fractional transforms
* and resulting anti-aliasing.
* https://github.com/Leaflet/Leaflet/issues/3575
*/
(function(){
var originalInitTile = L.GridLayer.prototype._initTile
L.GridLayer.include({
_initTile: function (tile) {
originalInitTile.call(this, tile);
var tileSize = this.getTileSize();
tile.style.width = tileSize.x + 1 + 'px';
tile.style.height = tileSize.y + 1 + 'px';
}
});
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment