Skip to content

Latest commit

 

History

History
29 lines (23 loc) · 1.08 KB

File metadata and controls

29 lines (23 loc) · 1.08 KB

ol3-async-source

An Asynchronous ImageCanvas Source for OpenLayers 3.x

Usage

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.

Example

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: ...
});

License

BSD-2 (c) Commonwealth Computer Research, Inc.