Mark
Mark

Reputation: 519

How to get a pointer cursor on feature hover but only if not covered by a popup?

I change the mouse cursor to "pointer" on features the following way:

// change mouse cursor when over marker
map.on('pointermove', function(e) {
    var pixel = map.getEventPixel(e.originalEvent);
    var hit = map.hasFeatureAtPixel(pixel);
    map.getTarget().style.cursor = hit ? 'pointer' : '';
});

The problem is, when I open a popup, the cursor changes even if the feature is covered by the popup (see https://jsfiddle.net/Ld9rup3v/2/: click on the lower point and you can hover over the upper point through the popup). How can I prevent that?

Upvotes: 2

Views: 629

Answers (1)

Mark
Mark

Reputation: 519

OK, I found a simple CSS workaround:

.popover { cursor:default; }

Upvotes: 3

Related Questions