Christophe Blin
Christophe Blin

Reputation: 1909

Creating a layer in javascript?

I have a code that is working with a canvas and I'd like to convert it into a layer.

The problem is that I do not want to use the build mechanism of OL3, I just want to use plain javascript.

At the moment, the problem I have is that my handleRender_ function is never called.

Here is my JS code :

ol.layer.MyLayerProperty = {

};



ol.layer.My = function (opt_options) {
    var options = opt_options || {};

    ol.layer.Layer.call(this, options);

    this.on('render', this.handleRender_.bind(this)); //I suspect this is not working

};
ol.inherits(ol.layer.My, ol.layer.Layer);


ol.layer.My.prototype.handleRender_ = function (event) {  
    console.log('render process'); //never called
};        

Upvotes: 0

Views: 209

Answers (1)

Christophe Blin
Christophe Blin

Reputation: 1909

In fact, to display a canvas "above" openlayers, you simply have to use ImageCanvas.

see http://www.acuriousanimal.com/thebookofopenlayers3/chapter03_04_imagecanvas.html for example

Upvotes: 1

Related Questions