Skip to content

Commit

Permalink
Added onCameraMove event on the map controller
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusvn committed Jan 9, 2024
1 parent fff0265 commit ad1456d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/src/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ typedef void OnCameraIdleCallback();

typedef void OnMapIdleCallback();

typedef void OnCameraMoveCallback(CameraPosition location);

/// Controller for a single MaplibreMap instance running on the host platform.
///
/// Change listeners are notified upon changes to any of
Expand Down Expand Up @@ -89,6 +91,9 @@ class MaplibreMapController extends ChangeNotifier {

_mapboxGlPlatform.onCameraMovePlatform.add((cameraPosition) {
_cameraPosition = cameraPosition;
for (final fun in List<OnCameraMoveCallback>.of(onCameraMove)) {
fun(cameraPosition);
}
notifyListeners();
});

Expand Down Expand Up @@ -184,6 +189,8 @@ class MaplibreMapController extends ChangeNotifier {

final OnMapIdleCallback? onMapIdle;

final onCameraMove = <OnCameraMoveCallback>[];

/// Callbacks to receive tap events for symbols placed on this map.
final ArgumentCallbacks<Symbol> onSymbolTapped = ArgumentCallbacks<Symbol>();

Expand Down

0 comments on commit ad1456d

Please sign in to comment.