Open ishafiul opened 3 months ago
Have you tried using onFeatureTapped? As you are using geoJSON this may be the method you are looking for.
onFeatureTapped works for all kinds of geoJSON features. So say you added geoJSON points, lines, polygons etc, the onFeatureTapped would run for all of those layers.
After adding your geoJSON layers to the map, run the following code to add tap events to your symbols.
controller.onFeatureTapped.add((dynamic feature, Point<double> point, LatLng latLng) async {
}
Have you tried using onFeatureTapped? As you are using geoJSON this may be the method you are looking for.
onFeatureTapped works for all kinds of geoJSON features. So say you added geoJSON points, lines, polygons etc, the onFeatureTapped would run for all of those layers.
After adding your geoJSON layers to the map, run the following code to add tap events to your symbols.
controller.onFeatureTapped.add((dynamic feature, Point<double> point, LatLng latLng) async { }
Thanks, it's working. Inside onFeatureTapped
, queryRenderedFeatures
is helping me solve this problem.
Platforms
all
Version of flutter maplibre_gl
0.20.0
Bug Description
I was trying to add a
SymbolLayer
to place some symbols. Now, I need to add a callback function to perform some operations when those symbols are tapped. However, for some reason, the tap event is not being registered. When I usecontroller.addSymbol
, it works, but it doesn't work forcontroller.addSymbolLayer.
Steps to Reproduce
MapLibreMap
onSymbolTapped
event theExpected Results
When a symbol is tapped, the expected result is for the
onSymbolTapped
function to be called.Actual Results
it will print
tapped
fromcontroller.onSymbolTapped.add
Code Sample