Ionic-native Google Maps - Multiple markers detect infowindow click


#1

hi,
i am using the ionic-native Google Maps. I’m trying to detect click on the title canvas, does anyone know how to do this ?

thanks

loadMap(){

var latitude 	= Global.userCoords['latitude'];
var longitude 	= Global.userCoords['longitude'];


let map = new GoogleMap('map');
var markers = [];
map.one(GoogleMapsEvent.MAP_READY).then(() => {
	let myPosition = new GoogleMapsLatLng(latitude, longitude);
	map.moveCamera({ target: myPosition, zoom: 16 }); 
	this.storage.get('listagemRestaurantes').then((list) => {
		if( list != undefined && list.length > 1 ){
			var x;
			var obj = JSON.parse(list); 
			var canvas = [];
			for (x in obj) {
				var pd = obj[x]['ponderador'];
				var pm = obj[x]['preco_medio'];
				
				
				canvas[x] = document.createElement('canvas');
				canvas[x].width = 180;
				canvas[x].height = 50;
				var context = canvas[x].getContext('2d');

				var img = new Image();
				img.src = obj[x]['imagem_defeito'];
				context.drawImage(img, 0, 0,50,50); 
				context.font = 'bolder 10pt arial';
				context.fillStyle = 'black';
				context.fillText( obj[x]['nome'] , 60, 15);
				
				context.font = '8pt arial';
				context.fillStyle = 'black';
				context.fillText( obj[x]['morada']+' '+obj[x]['concelho'] , 60, 30);

				context.font = '8pt arial';
				context.fillStyle = 'black';
				context.fillText( obj[x]['tipos_cozinha'] , 60, 45);
				
				markers[x] = map.addMarker({
					position: new GoogleMapsLatLng(obj[x]['gps_lat'], obj[x]['gps_lon']), 
					title: canvas[x].toDataURL(),
					icon: "www.linkToTheIcon ",
				});
      
      
                                    canvas[x].addEventListener('click', function() {
						alert('Test');
			}, false);
      
      
			}
			obj = undefined;
		} 
		list = undefined;
	}).catch((e) => {
		console.log(e);
	});
});

}