Skip to content

Commit

Permalink
feat: Add placeId to map click events
Browse files Browse the repository at this point in the history
When clicking on a point of interest on a map the emiting event will include the placeId of the location clicked.

closes issue sebholstein#691.
  • Loading branch information
yosigolan authored and LeandroPereiraDaCruz committed Mar 9, 2019
1 parent ff06075 commit d24ae8b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/core/directives/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -577,13 +577,15 @@ export class AgmMap implements OnChanges, OnInit, OnDestroy {
coords: {
lat: event.latLng.lat(),
lng: event.latLng.lng()
}
},
placeId: null
};
// we cant use instanceOf since the IconMouseEvent is an interface
if ((<any>event).placeId !== undefined && (<any>event).placeId !== null) {
if (!this.isToShowDefaultInfoWindowForIcons) {
event.stop();
}
value.placeId = (<google.maps.IconMouseEvent>event).placeId;
}
e.emitter.emit(value);
});
Expand Down
5 changes: 4 additions & 1 deletion packages/core/map-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ export {
/**
* MouseEvent gets emitted when the user triggers mouse events on the map.
*/
export interface MouseEvent { coords: LatLngLiteral; }
export interface MouseEvent {
coords: LatLngLiteral;
placeId: string;
}

0 comments on commit d24ae8b

Please sign in to comment.