Skip to content

Commit 38dd022

Browse files
committed
feat(google-maps): Add support for mouse events in map-advanced-marker
1 parent 2b972e1 commit 38dd022

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

src/google-maps/map-advanced-marker/map-advanced-marker.spec.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ describe('MapAdvancedMarker', () => {
127127
flush();
128128

129129
expect(addSpy).toHaveBeenCalledWith('click', jasmine.any(Function));
130+
expect(addSpy).toHaveBeenCalledWith('dblclick', jasmine.any(Function));
131+
expect(addSpy).toHaveBeenCalledWith('mouseout', jasmine.any(Function));
132+
expect(addSpy).toHaveBeenCalledWith('mouseover', jasmine.any(Function));
133+
expect(addSpy).toHaveBeenCalledWith('mouseup', jasmine.any(Function));
134+
expect(addSpy).toHaveBeenCalledWith('rightclick', jasmine.any(Function));
130135
expect(addSpy).not.toHaveBeenCalledWith('drag', jasmine.any(Function));
131136
expect(addSpy).not.toHaveBeenCalledWith('dragend', jasmine.any(Function));
132137
expect(addSpy).not.toHaveBeenCalledWith('dragstart', jasmine.any(Function));
@@ -163,6 +168,11 @@ describe('MapAdvancedMarker', () => {
163168
[gmpDraggable]="gmpDraggable"
164169
[zIndex]="zIndex"
165170
(mapClick)="handleClick()"
171+
(mapDblclick)="handleDblclick()"
172+
(mapMouseout)="handleMouseout()"
173+
(mapMouseover)="handleMouseover()"
174+
(mapMouseup)="handleMouseup()"
175+
(mapRightclick)="handleRightclick()"
166176
[options]="options" />
167177
</google-map>
168178
`,
@@ -179,4 +189,9 @@ class TestApp {
179189
options: google.maps.marker.AdvancedMarkerElementOptions;
180190

181191
handleClick() {}
192+
handleDblclick() {}
193+
handleMouseout() {}
194+
handleMouseover() {}
195+
handleMouseup() {}
196+
handleRightclick() {}
182197
}

src/google-maps/map-advanced-marker/map-advanced-marker.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,36 @@ export class MapAdvancedMarker implements OnInit, OnChanges, OnDestroy, MapAncho
124124
@Output() readonly mapClick: Observable<google.maps.MapMouseEvent> =
125125
this._eventManager.getLazyEmitter<google.maps.MapMouseEvent>('click');
126126

127+
/**
128+
* This event is fired when the AdvancedMarkerElement is double-clicked.
129+
*/
130+
@Output() readonly mapDblclick: Observable<google.maps.MapMouseEvent> =
131+
this._eventManager.getLazyEmitter<google.maps.MapMouseEvent>('dblclick');
132+
133+
/**
134+
* This event is fired when the mouse moves out of the AdvancedMarkerElement.
135+
*/
136+
@Output() readonly mapMouseout: Observable<google.maps.MapMouseEvent> =
137+
this._eventManager.getLazyEmitter<google.maps.MapMouseEvent>('mouseout');
138+
139+
/**
140+
* This event is fired when the mouse moves over the AdvancedMarkerElement.
141+
*/
142+
@Output() readonly mapMouseover: Observable<google.maps.MapMouseEvent> =
143+
this._eventManager.getLazyEmitter<google.maps.MapMouseEvent>('mouseover');
144+
145+
/**
146+
* This event is fired when the mouse button is released over the AdvancedMarkerElement.
147+
*/
148+
@Output() readonly mapMouseup: Observable<google.maps.MapMouseEvent> =
149+
this._eventManager.getLazyEmitter<google.maps.MapMouseEvent>('mouseup');
150+
151+
/**
152+
* This event is fired when the AdvancedMarkerElement is right-clicked.
153+
*/
154+
@Output() readonly mapRightclick: Observable<google.maps.MapMouseEvent> =
155+
this._eventManager.getLazyEmitter<google.maps.MapMouseEvent>('rightclick');
156+
127157
/**
128158
* This event is repeatedly fired while the user drags the AdvancedMarkerElement.
129159
* https://developers.google.com/maps/documentation/javascript/reference/advanced-markers#AdvancedMarkerElement.drag

0 commit comments

Comments
 (0)