Skip to content

Commit 1a6a69a

Browse files
committed
feat: map getZoom
1 parent 9345b6a commit 1a6a69a

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

src/ui/index.android.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,9 @@ export class CartoMap<T = DefaultLatLonKeys> extends CartoViewBase {
203203
this.mapView.setMapRotation(value, toNativeMapPos(targetPos), duration / 1000);
204204
}
205205
}
206+
getZoom() {
207+
return this.mapView.getZoom();
208+
}
206209
setZoom(value: number, targetPos: MapPos | number, duration: number = 0) {
207210
if (typeof targetPos === 'number') {
208211
this.mapView.setZoom(value, targetPos / 1000);

src/ui/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ export class CartoMap<T = DefaultLatLonKeys> extends View {
211211
fromNativeMapPos(position: any): GenericMapPos<T>;
212212
getOptions(): MapOptions;
213213

214+
getZoom(): number;
214215
setZoom(value: number, target: number | GenericMapPos<T>, duration?: number);
215216
setMapRotation(value: number, target: number | GenericMapPos<T>, duration?: number);
216217
setBearing(value: number, duration?: number);

src/ui/index.ios.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,9 @@ export class CartoMap<T = DefaultLatLonKeys> extends CartoViewBase {
232232
const screenBounds = toNativeScreenBounds({ min: { x: 0, y: 0 }, max: { x: this.getMeasuredWidth(), y: this.getMeasuredHeight() } }) as NTScreenBounds;
233233
return new MapBounds<T>(fromNativeMapPos(this.mapView.screenToMap(screenBounds.getMin())), fromNativeMapPos(this.mapView.screenToMap(screenBounds.getMax())));
234234
}
235+
getZoom() {
236+
return this.mapView.getZoom();
237+
}
235238
setZoom(value: number, targetPos: MapPos | number, duration: number = 0) {
236239
if (typeof targetPos === 'number') {
237240
this.mapView.setZoomDurationSeconds(value, targetPos / 1000);

0 commit comments

Comments
 (0)