Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a mouseover/mouseout listener to a ol.Map?

In ol2 I used to use:

map.on( "mouseover mouseout", function( evt ) {...});

How can I do this in ol3?

like image 877
MoreScratch Avatar asked Dec 24 '22 15:12

MoreScratch


1 Answers

Take a look at this plunker, there's a lot of other possibilities:

What you ask is done with:

map.on('pointermove', function(event) {

});

Mouseout:

map.getViewport().addEventListener('mouseout', function(evt){
    console.info('out');
}, false);
like image 192
Jonatas Walker Avatar answered Feb 09 '23 15:02

Jonatas Walker