An Asynchronous ImageCanvas Source for OpenLayers 3.x
This source is based on the original ol.source.ImageCanvas (docs) and the interface is largely the same, but of course there are some differences:
- Instead of the canvasFunction returning a canvas object, the source has an extra config parameter: a reference to a canvas object, called
canvasElement
- The canvasFunction has an extra parameter, a
callback
to call when rendering is complete.
var canvas = document.createElement('canvas');
var source = new ol.source.ImageCanvasAsync({
canvasElement: canvas,
canvasFunction: function (extent, resolution, pixelRatio, size, projection, callback) {
doAsyncRender(...).then(callback);
}
projection: ...,
ratio: ...
});
BSD-2 (c) Commonwealth Computer Research, Inc.