Jacobian
Jacobian

Reputation: 10862

OpenLayers bindTo is not a function

I'm getting this error message when I try to bind view of the first map to the second map. So, I have two maps - mapOne and mapTwo. When I do not make any binding they are working nicely. However, when I slightly change declaration of mapTwo and add binding statement, I get that error message. This is a code I have.

// Before. It works good.
var mapTwo = new ol.Map({
    target: obj,
    renderer: 'canvas',
    layers: layers,
    controls:[],
    view: view
});

//After. It does not work
var mapTwo = new ol.Map({
    target: obj,
    renderer: 'canvas',
    layers: layers,
    controls:[]
});

mapTwo.bindTo('view', mapOne);

So, what am I doing wrong here??

Upvotes: 0

Views: 1583

Answers (1)

ahocevar
ahocevar

Reputation: 5647

bindTo was removed in v3.5.0. See the release notes:

"If you want to get notification about ol.Object property changes, you can listen for the 'propertychange' event (e.g. object.on('propertychange', listener)). Two-way binding can be set up at the application level using property change listeners. See #3472 for details on the change."

Upvotes: 4

Related Questions