From 64a6248fbbbe38622af236d2d6506fdaae5022bd Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Wed, 13 May 2020 13:07:43 +0200 Subject: [PATCH] Update public.gmaps.js --- public/js/public.gmaps.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/public/js/public.gmaps.js b/public/js/public.gmaps.js index 0856701..199545a 100644 --- a/public/js/public.gmaps.js +++ b/public/js/public.gmaps.js @@ -101,9 +101,14 @@ var map = { if (this.places.length > 1) { this.map.fitBounds(bounds); } else if (this.places.length === 1) { - this.map.setCenter(new google.maps.LatLng(this.places[0].latitude, this.places[0].longitude)); + this.openMarker(this.places[0].marker); } }, + openMarker: function(marker) { + this.map.panTo(marker.position); + this.map.setZoom(13); + google.maps.event.trigger(marker, 'click'); + }, onMarkerClick: function(marker) { this.infoWindow.setContent(marker.content); this.infoWindow.open(this.map, marker);