mapbox / mapbox/mapbox-maps-flutter
Point annotations disapear when zooming out
Nobody has claimed this yet.
- Dominant language
- Dart
- Stars
- 380
- Forks
- 204
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
When i zoom out my pointannotaions dissapear, when i zoom in again they show up once again. Im currently testing on IOS.
Do i do something wrong here?
The following code, is what i use for making the points at the moment:
```
_onMapCreated(MapboxMap mapboxMap) {
this.mapboxMap = mapboxMap;
mapboxMap.annotations.createPointAnnotationManager().then((value) async {
pointAnnotationManager = value;
final ByteData bytes =
await rootBundle.load('assets/images/onboarding0.png');
final Uint8List list = bytes.buffer.asUint8List();
pointAnnotationManager?.setIconAllowOverlap(true);
pointAnnotationManager?.setIconIgnorePlacement(true);
createEventAnnotations();
pointAnnotationManager?.addOnPointAnnotationClickListener(
AnnotationClickListener(context, events, mapboxMap));
});
}
```
```
List events = [
Event(
id: '1',
holderName: 'Pizza Boys',
address: 'husene, 2',
title: 'Spis min gris',
tags: 'food',
description: 'Lækker skinke!',
imageUrls: ['http://example.com/image1.jpg'],
latitude: 56.1685,
longitude: 10.2134,
),]
```
```
void createEventAnnotations() async {
final ByteData bytes =
await rootBundle.load('assets/images/onboarding0.png');
final Uint8List list = bytes.buffer.asUint8List();
List annotationOptions = events.map((event) {
return PointAnnotationOptions(
geometry: Point(
coordinates:
TurfPosition.Position(event.longitude, event.latitude)),
textField: event.title,
textOffset: [0.0, -4.0],
textColor: Colors.red.value,
iconSize: 0.3,
iconOffset: [0.0, -5.0],
symbolSortKey: 10.0,
image: list,
);
}).toList();
pointAnnotationManager?.createMulti(annotationOptions);
}
```
https://github.com/mapbox/mapbox-maps-flutter/assets/55810497/8dec1d56-542e-490d-95fb-02fa6892859b
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with _onMapCreated and createEventAnnotations, especially the PointAnnotationManager configuration and PointAnnotationOptions used for the iOS map. Reproduce the reported behavior by zooming out and back in with the supplied annotation setup, then verify that point annotations remain visible at both zoom levels.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100