From 5f1ae68e347dea6ded9b0fecba8edf3cd5a3cb9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Sun, 27 Dec 2015 09:55:10 +0100 Subject: [PATCH] feat(SebmGoogleMap): support double-click event Now, you can subscribe to double-click events: ``` ``` The $event is a `MapMouseEvent` type that contains the coords of the double-click. ``` import {MapMouseEvent} from 'angular2-google-maps/core'; class App { mapClicked(event: MapMouseEvent) { console.log(event.coords.lat, event.coords.lng); } } ``` --- docs/api/components_directives/sebmGoogleMap.md | 9 +++++---- src/directives/google-map.ts | 4 +++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/api/components_directives/sebmGoogleMap.md b/docs/api/components_directives/sebmGoogleMap.md index 740317c45..da66f3ee4 100644 --- a/docs/api/components_directives/sebmGoogleMap.md +++ b/docs/api/components_directives/sebmGoogleMap.md @@ -32,10 +32,11 @@ import {SebmGoogleMap} from 'angular2-google-maps/core'; ### Events -| Event name | Arguments | Description | -|---------------|---------------------------------|----------------------------------------------------------| -| mapClick | [MapMouseEvent](#MapMouseEvent) | Gets emitted when the user clicks on the map | -| mapRightClick | [MapMouseEvent](#MapMouseEvent) | Get emitted when the user uses a right click on the map. | +| Event name | Arguments | Description | +|---------------|---------------------------------|-------------------------------------------------------------------------------------------------------------------------------------| +| mapClick | [MapMouseEvent](#MapMouseEvent) | Gets emitted when the user clicks on the map | +| mapRightClick | [MapMouseEvent](#MapMouseEvent) | Gets emitted when the user uses a right click on the map. | +| mapDblClick | [MapMouseEvent](#MapMouseEvent) | Gets emitted when the user double-clicks on the map. Note that the `mapClick` event emitter will also fire, right before this one. | ### Event Interfaces diff --git a/src/directives/google-map.ts b/src/directives/google-map.ts index fad8ff678..67f49a12a 100644 --- a/src/directives/google-map.ts +++ b/src/directives/google-map.ts @@ -30,6 +30,7 @@ export class SebmGoogleMap { @Output() mapClick: EventEmitter = new EventEmitter(); @Output() mapRightClick: EventEmitter = new EventEmitter(); + @Output() mapDblClick: EventEmitter = new EventEmitter(); constructor(elem: ElementRef, _mapsWrapper: GoogleMapsAPIWrapper, renderer: Renderer) { this._mapsWrapper = _mapsWrapper; @@ -106,7 +107,8 @@ export class SebmGoogleMap { const events: Event[] = [ {name: 'click', emitter: this.mapClick}, - {name: 'rightclick', emitter: this.mapRightClick} + {name: 'rightclick', emitter: this.mapRightClick}, + {name: 'dblclick', emitter: this.mapDblClick} ]; events.forEach((e: Event) => {