-
Notifications
You must be signed in to change notification settings - Fork 173
feat: fire onMapClick for all map taps, including after interactive features #707
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
feat: fire onMapClick for all map taps, including after interactive features #707
Conversation
Modified Android, iOS, and Web implementations to always fire onMapClick event regardless of whether an interactive feature was tapped. When tapping an interactive feature, both onFeatureTapped and onMapClick will now fire. Co-authored-by: gabbopalma <[email protected]>
Co-authored-by: gabbopalma <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a bug where onMapClick callbacks were not firing when users tapped on interactive style layers (e.g., custom SymbolLayers). Previously, the events were mutually exclusive - either onFeatureTapped OR onMapClick would fire. Now both events fire when tapping interactive features, enabling users to query rendered features in onMapClick callbacks regardless of what was tapped.
Changes:
- Modified tap handlers on Android, iOS, and Web platforms to always fire
map#onMapClickfor all taps - Feature tap events (
feature#onTap) still fire when tapping interactive features - Changed from mutually exclusive event handling to both events firing together
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| maplibre_gl_web/lib/src/maplibre_web_gl_platform.dart | Updated Web platform tap handler to fire both events |
| maplibre_gl/ios/maplibre_gl/Sources/maplibre_gl/MapLibreMapController.swift | Updated iOS platform tap handler to fire both events |
| maplibre_gl/android/src/main/java/org/maplibre/maplibregl/MapLibreMapController.java | Updated Android platform tap handler to fire both events |
| maplibre_gl/android/gradle/wrapper/gradle-wrapper.jar | Gradle wrapper binary update (unrelated to main PR purpose) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Very nice 👍 |
|
Happy for this! @f1sh1918 LGTM |
onMapClickdid not fire when tapping interactive style layers (e.g., custom SymbolLayers added viaaddSymbolLayer), preventing users from querying features in the callback.Changes
map#onMapClickfor all taps, while still firingfeature#onTapwhen tapping interactive featuresImpact
Users can now use
queryRenderedFeaturesInRectinonMapClickcallbacks regardless of what was tapped:No breaking changes. Existing
onFeatureTappedcallbacks continue to work as before.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
dl.google.com/usr/lib/jvm/temurin-21-jdk-amd64/bin/java /usr/lib/jvm/temurin-21-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -Xmx1536M -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.13-bin/5xuhj0ry160q40clulazy9h7d/gradle-8.13/lib/gradle-daemon-main-8.13.jar(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.