Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support a "cursor" style property #1353

Closed
Tracked by #229
minikarma opened this issue Jun 30, 2015 · 8 comments
Closed
Tracked by #229

Support a "cursor" style property #1353

minikarma opened this issue Jun 30, 2015 · 8 comments
Labels
feature 🍏 mapbox.js → GL JS For feature parity with mapbox.js or Leaflet

Comments

@minikarma
Copy link

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.

@ghost
Copy link

ghost commented Jan 16, 2016

Here is an example implementation of making the cursor into a pointer: http://bl.ocks.org/danswick/4906b495e0b206758f71

@lucaswoj lucaswoj changed the title Feature request: Cursor 'pointer' on interactive layers Support a "cursor" style property Jul 28, 2016
@lucaswoj
Copy link
Contributor

This feature will be very useful alongside #1002.

@lucaswoj
Copy link
Contributor

We will probably want to implement this in tandem with #200

@mourner
Copy link
Member

mourner commented Jul 20, 2018

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.

@mourner mourner closed this as completed Jul 20, 2018
@linx97
Copy link

linx97 commented Jan 31, 2019

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.

@ryanhamley
Copy link
Contributor

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.

@minikarma
Copy link
Author

minikarma commented Jan 31, 2019

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!

@isattar
Copy link

isattar commented Aug 27, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 🍏 mapbox.js → GL JS For feature parity with mapbox.js or Leaflet
Projects
None yet
Development

No branches or pull requests

8 participants