feat: Add ViewAnnotations #885
Replies: 5 comments
|
Have you looked at how our |
|
Well, I didn't know about that one, but it looks promising. If that works out, maybe a small sample in the documentation or a more generic looking function would be a nice improvement. |
it should just be the existing val dpTarget =
remember(targetPosition, cameraState.position) {
cameraState.projection?.screenLocationFromPosition(targetPosition)
} |
|
Yeah, I had that method in my first Overlay concept, now I tried using the parameters/modifiers the PointerPinButton uses. The problem is, that it lags behind on the map. See my attached video: screen-20260518-003726-1779057437253.mp4 |
|
I'd expect any solution involving syncing a View to the camera position to have the same problem. In your video, it's not the overlay lagging behind, but the map. You can see your overlay is tightly synced with the touch indicator, but the map is behind. This implies the camera updates from MapLibre are ahead of the actual map movement. Maybe it's possible to reduce the map's latency, I haven't investigated what introduces that latency. |
Uh oh!
There was an error while loading. Please reload this page.
I want to render custom @composable functions pinned to geographic coordinates using Mapbox's native View Annotations API, rather than building a manual overlay system.
What I tried
I built a coordinate overlay that converts geo-coordinates + camera state into Compose
IntOffsets, but couldn't get it to stay in sync with the map during drag gestures. I also tried using theonFramecallback with a custom tick-based state, but the composable recomposition never aligned properly with the map's render frames.What I want
Use
ViewAnnotationdirectly insideMaplibreMap:This hands off position sync to the SDK, which should eliminate the lag entirely. Ideally this also supports anchoring, z-ordering, and attaching to existing layer features.
All reactions