Leaflet / Leaflet.TileLayer.NoGap

Experiment trying to get rid of the 1px gap between tiles
Other
38 stars 14 forks source link

make into an es6 module #8

Closed ebrensi closed 4 years ago

ebrensi commented 4 years ago

This is an incomplete pull request to demonstrate how we might structure a Leaflet plugin to work with both the aging L namespace and using es6 imports. Particularly, if we want to use multiple plugins that modify the same object. In this case it's TileLayer. The default behavior of a Leaflet plugin is to load it on top of a leaflet import so that everything uses the same L object.

With this fork we can import only the updates and integrate them ourselves, like

import { TileLayer } from "leaflet";
import { options, includes } from "Leaflet.TileLayer.NoGap.js";
import { options as options2, includes as includes2 } from "another.plugin.js" 

TileLayer.mergeOptions(options);
TileLayer.mergeOptions(options2);

TileLayer.include(includes)
TileLayer.include(includes2);

and then use that TileLayer in our code, or

export {TileLayer as Super.Duper.TileLayer}

so that another app can use it.

ebrensi commented 4 years ago

ok never mind.