From c41ff613ff0af7420b4c74acd20bde7bf9c24b80 Mon Sep 17 00:00:00 2001 From: hayssm Date: Fri, 16 Sep 2016 01:37:45 -0600 Subject: [PATCH 1/2] feat(SebmGoogleMapMarker): Marker Mouse Event Enhancement Add mouseover and mouseout events to markers. --- src/core/directives/google-map-marker.ts | 26 +++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/core/directives/google-map-marker.ts b/src/core/directives/google-map-marker.ts index a2cb6681b..aa1d42e11 100644 --- a/src/core/directives/google-map-marker.ts +++ b/src/core/directives/google-map-marker.ts @@ -40,7 +40,7 @@ let markerId = 0; 'latitude', 'longitude', 'title', 'label', 'draggable: markerDraggable', 'iconUrl', 'openInfoWindow', 'fitBounds', 'opacity', 'visible', 'zIndex' ], - outputs: ['markerClick', 'dragEnd'] + outputs: ['markerClick', 'dragEnd', 'mouseOver', 'mouseOut'] }) export class SebmGoogleMapMarker implements OnDestroy, OnChanges, AfterContentInit { /** @@ -106,6 +106,16 @@ export class SebmGoogleMapMarker implements OnDestroy, OnChanges, AfterContentIn */ dragEnd: EventEmitter = new EventEmitter(); + /** + * This event is fired when the user mouses over the marker. + */ + mouseOver: EventEmitter = new EventEmitter(); + + /** + * This event is fired when the user mouses outside the marker. + */ + mouseOut: EventEmitter = new EventEmitter(); + @ContentChild(SebmGoogleMapInfoWindow) private _infoWindow: SebmGoogleMapInfoWindow; private _markerAddedToManger: boolean = false; @@ -173,6 +183,20 @@ export class SebmGoogleMapMarker implements OnDestroy, OnChanges, AfterContentIn this.dragEnd.emit({coords: {lat: e.latLng.lat(), lng: e.latLng.lng()}}); }); this._observableSubscriptions.push(ds); + + const mover = + this._markerManager.createEventObservable('mouseover', this) + .subscribe((e: mapTypes.MouseEvent) => { + this.mouseOver.emit({coords: {lat: e.latLng.lat(), lng: e.latLng.lng()}}); + }); + this._observableSubscriptions.push(mover); + + const mout = + this._markerManager.createEventObservable('mouseout', this) + .subscribe((e: mapTypes.MouseEvent) => { + this.mouseOut.emit({coords: {lat: e.latLng.lat(), lng: e.latLng.lng()}}); + }); + this._observableSubscriptions.push(mout); } /** @internal */ From d49577b0369c037571116567b6442eed66daae54 Mon Sep 17 00:00:00 2001 From: hayssm Date: Tue, 20 Sep 2016 11:44:29 -0700 Subject: [PATCH 2/2] fix(SebmGoogleMapMarker): formatting mouse event changes on markers --- src/core/directives/google-map-marker.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/core/directives/google-map-marker.ts b/src/core/directives/google-map-marker.ts index aa1d42e11..2b57e9ad0 100644 --- a/src/core/directives/google-map-marker.ts +++ b/src/core/directives/google-map-marker.ts @@ -186,16 +186,16 @@ export class SebmGoogleMapMarker implements OnDestroy, OnChanges, AfterContentIn const mover = this._markerManager.createEventObservable('mouseover', this) - .subscribe((e: mapTypes.MouseEvent) => { - this.mouseOver.emit({coords: {lat: e.latLng.lat(), lng: e.latLng.lng()}}); - }); + .subscribe((e: mapTypes.MouseEvent) => { + this.mouseOver.emit({coords: {lat: e.latLng.lat(), lng: e.latLng.lng()}}); + }); this._observableSubscriptions.push(mover); const mout = - this._markerManager.createEventObservable('mouseout', this) - .subscribe((e: mapTypes.MouseEvent) => { - this.mouseOut.emit({coords: {lat: e.latLng.lat(), lng: e.latLng.lng()}}); - }); + this._markerManager.createEventObservable('mouseout', this) + .subscribe((e: mapTypes.MouseEvent) => { + this.mouseOut.emit({coords: {lat: e.latLng.lat(), lng: e.latLng.lng()}}); + }); this._observableSubscriptions.push(mout); }