-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
event.stopPropagation() working but marked as "not a function" when executed #9369
Comments
@jdato The argument You may want to use the map.on('click', 'unclustered-point', function(e) {
[...]
// Issue report
e.originalEvent.stopPropagation();
} |
@brncsk thanks for chiming in, you are right! Nothing to address on the GL JS side here. |
Thanks guys. Regarding the answer @brncsk, I've tried that before and it doesn't seem to work for me - on the jsbin either. Which is odd. |
@grantmccall Nope. I've built a workaround that works for my scenario... |
For future reference, here's an easy workaround: https://stackoverflow.com/a/53892631/8461337 |
it is said that in R17, they gonna fix it... |
Hi, I created an add-on that allows you to stop the propagation(with immediatePropagation support) of events between layers. Try this lib |
Hi @marucjmar , will your library solve this issue. |
Hi there,
I am currently facing an issue when clicking different elements on a map. The map has separate layers that contain points and clusters and the propagation of events need to be stopped after individual points have been clicked, because the main map event needs some event handling too in my case. The stop propagation on individual is not recognized as a valid method on the MapClickEvent and shows up as an error on the console, even though it works.
Check out this js-bin and try to click anywhere on the map but the unclustered points.
Explanation:
A listener that has been implemented at the very bottom listening to all map clicks, so that an alert will show up for every click anywhere on the map but the unclustered points.
At the end of the listener for the unclustered points a stopPropagation is being called to prevent the passing of the event to the new click listener. Thats where the error gets populated, but the event propagation is also stopped.
Error output:
mapbox-gl-js version: 1.8.1
browser: Google Chrome Version: 80.0.3987.122
Steps to Trigger Behavior
Link to Demonstration
https://jsbin.com/
Expected Behavior
Actual Behavior
Cheers!
The text was updated successfully, but these errors were encountered: