Skip to content

Commit

Permalink
fix: add parity with ti.map android for zoom level
Browse files Browse the repository at this point in the history
  • Loading branch information
hansemannn committed Sep 3, 2020
1 parent 1bf42c9 commit 4aa3d67
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
8 changes: 8 additions & 0 deletions Classes/TiGooglemapsViewProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -346,4 +346,12 @@
*/
- (NSNumber *)zoom;

/**
* Returns the current map view zoom level.
*
* @return A boxed float containing the current map view zoom level.
* @since 4.3.0
*/
- (NSNumber *)zoomLevel;

@end
6 changes: 6 additions & 0 deletions Classes/TiGooglemapsViewProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,12 @@ - (void)showAnnotations:(id)args
}

- (NSNumber *)zoom
{
DEPRECATED_REPLACED(@"Map.View.zoom", @"5.4.1", @"Map.View.zoomLevel");
return self.zoomLevel;
}

- (NSNumber *)zoomLevel
{
return @([[self mapView] mapView].camera.zoom);
}
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,14 @@ mapView.rotateGestures = false;
mapView.allowScrollGesturesDuringRotateOrZoom = false;
```

#### Get current zoom
#### Get current zoom level

```js
const currentZoom = mapView.zoom;
const currentZoom = mapView.zoomLevel;
```

Note: You can watch the `regionchanged` event to get realtime updates about the zoom level change
Note: You can watch the `regionchanged` event to get real time updates about the zoom level change.
See the `event.zoom` property for details.

#### Map Padding

Expand Down
2 changes: 1 addition & 1 deletion manifest
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# this is your module manifest and used by Titanium
# during compilation, packaging, distribution, etc.
#
version: 5.4.0
version: 5.4.1
apiversion: 2
architectures: armv7 arm64 i386 x86_64
description: ti.googlemaps
Expand Down

0 comments on commit 4aa3d67

Please sign in to comment.