maplibre / flutter-maplibre-gl

Customizable, performant and vendor-free vector and raster maps, flutter wrapper for maplibre-native and maplibre-gl-js (fork of flutter-mapbox-gl/maps)
https://pub.dev/packages/maplibre_gl
Other
226 stars 125 forks source link

[FEATURE] Camera Movement from controller and user #494

Closed Koboo closed 2 months ago

Koboo commented 2 months ago

Feature Description

Is there a way to check if the camera was moved by the user or the controller? I know I can listen to camera movement by using the change notifier of the controller and check the isCameraMoving value. But that doesn't tell if the reason for the movement was the controller or the user itself.

Describe alternatives you've considered

No response

Additional context

No response

Koboo commented 2 months ago

I got a workaround by creating a variable called bool _isCameraMovingByApp and everytime I call MapLibreController#animateCamera(..) I set the boolean to true. Then I'm listening to the camera idle callback on the MapLibreMap and set it back to false.

Using the boolean I can check in the change notifiers if the camera was moved by the user or by the controller.