Skip to content

Commit 1ba7ecb

Browse files
authored
Merge pull request #12 from maxiundtesa/master
Add getZoomLevel() Method to Controller
2 parents 7b77b14 + 493217a commit 1ba7ecb

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

ios/Classes/MapView/AppleMapController.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,8 @@ public class AppleMapController : NSObject, FlutterPlatformView, MKMapViewDelega
234234
result(self.mapView.isMyLocationButtonShowing ?? false)
235235
case "map#getMinMaxZoomLevels":
236236
result([self.mapView.minZoomLevel, self.mapView.maxZoomLevel])
237+
case "camera#getZoomLevel":
238+
result(self.mapView.calculatedZoomLevel)
237239
default:
238240
result(FlutterMethodNotImplemented)
239241
return

lib/src/controller.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,11 @@ class AppleMapController {
219219
});
220220
}
221221

222+
/// Returns the current zoomLevel.
223+
Future<double> getZoomLevel() async {
224+
return channel.invokeMethod<double>('camera#getZoomLevel');
225+
}
226+
222227
/// Return [LatLngBounds] defining the region that is visible in a map.
223228
Future<LatLngBounds> getVisibleRegion() async {
224229
final Map<String, dynamic> latLngBounds =

0 commit comments

Comments
 (0)