import '../../flutter_map.dart';

typedef OnCameraChangeListener = void Function(CameraChange cameraChange);

class CameraChange {
  CameraChangeType function; //onCameraChange | onCameraChangeFinish

  CameraPosition position;

  CameraChange({required this.function, required this.position});

  factory CameraChange.fromJson(Map<String, dynamic> map) {
    return CameraChange(
      function: map['function'] == CameraChangeType.onCameraChange.value
          ? CameraChangeType.onCameraChange
          : CameraChangeType.onCameraChangeFinish,
      position: CameraPosition.fromJson(map),
    );
  }
}
