import 'package:get/get_rx/src/rx_types/rx_types.dart';
import 'package:get/get_state_manager/src/simple/get_controllers.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';

class MapController extends GetxController {
  RxDouble zoom = 13.0.obs;
  GoogleMapController? googleMapController;

  void setController(GoogleMapController controller) {
    googleMapController = controller;
  }

  void zoomIn() {
    zoom.value++;
    if (googleMapController != null) {
      googleMapController!.animateCamera(
        CameraUpdate.zoomTo(zoom.value),
      );
    }
  }

  void zoomOut() {
    zoom.value--;
    if (googleMapController != null) {
      googleMapController!.animateCamera(
        CameraUpdate.zoomTo(zoom.value),
      );
    }
  }
}