放大我当前的位置图google nativescript

时间:2019-07-03 14:38:09

标签: google-maps nativescript zoom

我想缩放当前位置,而不是标记。我有以下代码:

onMapReady(event) {
    this.mapView = event.object;
    this.gMap = event.object.gMap;
    var UiSettings = this.gMap.getUiSettings();
    UiSettings.setMyLocationButtonEnabled(true);
    this.gMap.setMyLocationEnabled(true);
    this.itemsS = this.itemService.getItems();
                 for (let i = 0; i < this.itemsS.length; i++) {       
                    console.log('this.itemsS.length',this.itemsS.length)     
                    var marker = new Marker();
                    marker.position = Position.positionFromLatLng(this.itemsS[i].latitude, this.itemsS[i].longitude);
                    marker.title = this.itemsS[i].name;
                    marker.userData = { index: 1 };
                    this.mapView.addMarker(marker);   
               }
}

我尝试使用this.gMap.zoom = 20;,但没有任何反应。

在html中,我有以下代码:

 <MapView (mapReady)="onMapReady($event)"></MapView>

0 个答案:

没有答案