-
Notifications
You must be signed in to change notification settings - Fork 26
Hover popup mousemove #37
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
base: master
Are you sure you want to change the base?
Conversation
|
Thanks, this looks awesome!
It's been a while since I looked at this, but yeah, I had similar problems to you. I've just done some fiddling around, looking at the solutions here and think I have solved it. I've pushed a commit to master, can you check that works for you? (run |
This reverts commit baefeaf.
|
No dice for me, new error on testing (from In my sleep deprivation I also managed to wreck the commit history on this PR so if you do end up merging it if you wouldn't mind making sure to do a squash on it that would be great 😂 |
|
Interesting. Man it is really hard getting all this stuff to play nicely together. Also, to be honest, I don't think I have the headspace to sort out someone else's git history right now. If you want to make a new PR I'll try to take a look. |
For your consideration, I needed to add in an additional argument to
hoverPopupto allow me to change the mouse event for showing the popup tomousemove. When working with shapefiles that have overlapping area features or that otherwise don't have a gap between features, Mapbox only firesmouseenterwhen the mouse enters into an object of that layer, but not if the mouse moves from feature to feature in the same layer without ever leaving a feature completely. I wanted to be able to use your handy function, just have it trigger onmousemoveinstead in specific cases (the default works great for single-point features) to have the popup update content when moving between adjacent features without a gap.It also can make for a nice user experience to have the tooltip following the mouse.
Demo
Using
mouseenter, you can see it only updating when I move through an area where there are no features for that layer:Screenshot.2022-05-31.at.22.45.37.mp4
Setting the mode to
mousemoveinstead:Screenshot.2022-05-31.at.22.46.46.mp4
Proposing dropping it at the end of the options list and defaulting it to
mouseenterto maintain backwards-compatibility, but of course up to you if this is a welcome addition to your library.Testing
I blind-wrote a test for it as well based on some of the other tests, but I couldn't get the tests to run using any combination of things I tried (Jest throws a
SyntaxError: Cannot use import statement outside a moduleon the import statement innoflow/index.test.jseven on a fresh downloadyarn install && yarn pretest && yarn testand other combinations of things on Node v17.8.0). Happy to revise if I'm running the tests wrong.Codepens
mouseentermousemove