-
Notifications
You must be signed in to change notification settings - Fork 550
Closed
Labels
Description
Hello
i have some problem
1 - the symbol's center is placed at the target not the bottom edge of it
2 - on symbol tap i get null data
3 - on symbol tap also onMapClick is triggered
4 - symbol draggable is not working
MapboxMapController mapController;
void _onMapCreated(MapboxMapController controller) {
mapController = controller;
addImageFromAsset();
mapController.onSymbolTapped.add((argument) {
_onSymbolTapped(argument);
});
}
Future<void> addImageFromAsset() async {
final ByteData bytes = await rootBundle.load("assets/marker.png");
final Uint8List list = bytes.buffer.asUint8List();
return mapController.addImage("marker", list);
}
void _add() {
final map = {'data': "data is "};
mapController.addSymbol(_getSymbolOptions("marker"), map);
}
void _onSymbolTapped(Symbol symbol) {
print(symbol.data);
}
SymbolOptions _getSymbolOptions(String iconImage) {
return SymbolOptions(
draggable: true,
iconSize: 0.5,
geometry: LatLng(0.0,0.0),
iconImage: iconImage,
zIndex: 1);
}
//in scaffold body
MapboxMap(
onMapClick: (point, coordinates) {
print(point);
print(coordinates);
},
compassEnabled: false,
myLocationEnabled: true,
onMapCreated: _onMapCreated,
initialCameraPosition: const CameraPosition(
target: LatLng(0, 0), zoom: 15),
)
Reactions are currently unavailable