Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70795

Google map native rotate marker not working

$
0
0

@swapnilkoshti28 wrote:

Hello, I am using ionic google maps native. I am able to display google map with icon. But unable to rotate the icon. Below is my code snippet. But rotating icon is not working. Please help.

async ngOnInit() {
await this.platform.ready();
await this.loadMap();
this.add();
}

loadMap() {
this.map = GoogleMaps.create(‘map_canvas’, {
camera: {
target: {
lat: 43.0741704,
lng: -89.3809802
},
zoom: 18
}
});
}

public add() {
let latLng = {
lat: 43.0741704,
lng: -89.3809802
};
// Move the map camera to the location with animation
this.map.animateCamera({
target: latLng,
zoom: 17
});

// add a marker
let marker: Marker = this.map.addMarkerSync({
  icon: {
    url: 'https://mapsplugin.github.io/ionic-googlemaps-quickdemo-v4/assets/imgs/Number-2-icon.png',
    size: {
      width: 32,
      height: 24
    },
  },
  rotation: 32,
  title: '@ionic-native/google-maps plugin!',
  snippet: 'This plugin is awesome!',
  position: latLng,
  animation: GoogleMapsAnimation.BOUNCE,
});

// show the infoWindow
marker.showInfoWindow();

// If clicked it, display the alert
marker.on(GoogleMapsEvent.MARKER_CLICK).subscribe(() => {
  this.showToast('clicked!');
});

}

Posts: 4

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 70795

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>