UPDATE July 2016 , moved and updated to here: UPDATE July 2016 , moved and updated to here: https://github.com/Sumbera/gLayers.Leaflet
Leaflet Full view Canvas Overlay - straightforward full screen canvas overlay that calls custom user function for drawing. Mostly extracted from here added resize and few other parameters for callback Compare to same data SVG rendering here
//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 : <canvas>,
bounds : <bounds in WGS84>
size : <view size>,
zoomScale: <zoom scale is 1/resolution>,
zoom : <current zoom>,
options : <options passed >
};
Other useful full view Leaflet Canvas sources here:
- leaflet.heat
- [Full Canvas] (https://github.com/cyrilcherian/Leaflet-Fullcanvas)
- [CartoDb Leaflet.Canvas] (https://github.com/CartoDB/Leaflet.CanvasLayer)
Hi Stanislav.
Is it possible you set this up on github?
I use this class quite frequent and now after upgrading leaflet to
v1.0.0rc1
i ran into an issue. I'm getting aTypeError: callback is undefined
inleaflet-src.js:3293
(which is here).Here's a minimal jsfiddle: 6mw0wbh4.
Strange enough, I'm getting
TypeError: obj is undefined
inleaflet-src.js:90
(which is here) after removing themap.setView()
line.JSFiddle: hy2ghxqy.
I'm undecided whether this is an issue with leaflet or with the canvas overlay class. Could you help me figuring out what's causing this?
Cheers
5chdn