It would be great to use pointer cursor on layers with interactive: true style values.
For example I'm adding placemarks layer from geojson data and I want to let the users know what features is clickable on the map.
Thank you.
Here is an example implementation of making the cursor into a pointer: http://bl.ocks.org/danswick/4906b495e0b206758f71
This feature will be very useful alongside #1002.
We will probably want to implement this in tandem with #200
I think that with the new delegated events syntax (map.on('mouseenter', 'layer', () => { ... }), it's easy enough so that it's not necessary to introduce a new style property for this.
The easy solution that you mention, (map.on('mouseenter', 'layer', () => { ... }), consistently throws errors. The layer 'markers' does not exist in the map's style and cannot be queried for features It still works, but to have a solution that doesn't give errors would be cool.
This sounds like an unrelated error @linx97 I just tried the map.on('mouseenter', 'marker', () => {...}) solution and it worked without errors. Make sure that you have all your layers named properly without typos.
suppose it should be working after style fully loaded (use map.on('load', () = { ... });)
yes, looking back 3,5 years on this PR handling mouseenter events looks as a great solution!
When there are overlapping layers, a symbol layer that can show up on top of a fill layer, mouseenter and mouseleave leads to a flicker if you want a pointer cursor for both layers.
Most helpful comment
Here is an example implementation of making the cursor into a pointer: http://bl.ocks.org/danswick/4906b495e0b206758f71