Closed yildirim closed 10 years ago
AFAIK, Leaflet does not use canvas for rendering, so you can't really get its canvas.
This question is totally unrelated with EmberLeaflet and is much more suited for StackOverflow.
I believe Leaflet can use a canvas for rendering, but it prefers SVG/DOM as that is more accessible. You might be able to force it to use canvas, but I agree that this is a question better suited for StackOverflow or the Leaflet peeps.
Hi,
I need to get the color of a specified pixel on the map. I think that if I get canvas element, I can use html canvas methods to get the pixels' color. Here is a code snipped from my ember apps:
Simulation.MapLayer = EmberLeaflet.Layer.extend({ _newLayer: function() { return new L.Google('ROADMAP'); });
I am trying to get canvas as follows, var canvasTiles = Simulation.MapLayer.canvas(); canvasTiles.drawTile = function(canvas, tilePoint, zoom) { var ctx = canvas.getContext('2d'); ctx.fillRect(20,20,250,200); };
The above code is not working, I would be really appreciated if you can help me to get the canvas of the map, or other better solution to get the color of a pixel on the specified position on the map.
Thanks,