An open API service indexing awesome lists of open source software.

https://github.com/danwild/leafletjs-canvas-overlay

Repo for npm wrapper of https://gist.github.com/Sumbera/11114288
https://github.com/danwild/leafletjs-canvas-overlay

Last synced: about 1 year ago
JSON representation

Repo for npm wrapper of https://gist.github.com/Sumbera/11114288

Awesome Lists containing this project

README

          

Leaflet Full view Canvas Overlay - straightforward full screen canvas overlay that calls custom user function for drawing.
Mostly extracted from [here](https://github.com/Leaflet/Leaflet.heat) added resize and few other parameters for callback
Compare to same data SVG rendering [here](http://bl.ocks.org/Sumbera/7e8e57368175a1433791)

//Example:
L.canvasOverlay()
.params({data: points}) // optional add any custom data that will be passed to draw function
.drawing(drawingOnCanvas) // set drawing function
.addTo(leafletMap); // add this layer to leaflet map

//Custom drawing function:
function drawingOnCanvas(canvasOverlay, params) {
var ctx = params.canvas.getContext('2d');
params.options.data.map(function (d, i) {
// canvas drawing goes here
});
};

// parameters passed to custom draw function :
{
canvas : ,
bounds :
size : ,
zoomScale: ,
zoom : ,
options :
};

Other useful full view Leaflet Canvas sources here:
- [leaflet.heat](https://github.com/Leaflet/Leaflet.heat)
- [Full Canvas] (https://github.com/cyrilcherian/Leaflet-Fullcanvas)
- [CartoDb Leaflet.Canvas] (https://github.com/CartoDB/Leaflet.CanvasLayer)