Skip to content

Commit

Permalink
Adds support for mouse events.
Browse files Browse the repository at this point in the history
  • Loading branch information
DracoNoir committed Jan 28, 2015
1 parent 752d595 commit 9aba848
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions google-map.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,61 @@
@status alpha
@homepage http://googlewebcomponents.github.io/google-map
-->
<!--
Fired when the marker icon was clicked.
@event google-map-marker-click
@param {google.maps.MouseEvent} event The mouse event.
-->

<!--
Fired when the marker icon was double clicked.
@event google-map-marker-dblclick
@param {google.maps.MouseEvent} event The mouse event.
-->

<!--
Fired for a mousedown on the marker.
@event google-map-marker-mousedown
@param {google.maps.MouseEvent} event The mouse event.
-->

<!--
Fired when the DOM `mousemove` event is fired on the marker.
@event google-map-marker-mousemove
@param {google.maps.MouseEvent} event The mouse event.
-->

<!--
Fired when the mouse leaves the area of the marker icon.
@event google-map-marker-mouseout
@param {google.maps.MouseEvent} event The mouse event.
-->

<!--
Fired when the mouse enters the area of the marker icon.
@event google-map-marker-mouseover
@param {google.maps.MouseEvent} event The mouse event.
-->

<!--
Fired for a mouseup on the marker.
@event google-map-marker-mouseup
@param {google.maps.MouseEvent} event The mouse event.
-->

<!--
Fired for a rightclick on the marker.
@event google-map-marker-rightclick
@param {google.maps.MouseEvent} event The mouse event.
-->
<polymer-element name="google-map-marker" attributes="icon">
<template>
<style>
Expand Down Expand Up @@ -173,6 +228,21 @@
});
this.contentChanged();
setupDragHandler_.bind(this)();

this._forwardEvent('click');
this._forwardEvent('dblclick');
this._forwardEvent('mousedown');
this._forwardEvent('mousemove');
this._forwardEvent('mouseout');
this._forwardEvent('mouseover');
this._forwardEvent('mouseup');
this._forwardEvent('rightclick');
},

_forwardEvent: function(name) {
google.maps.event.addListener(this.marker, name, function(event) {
this.fire('google-map-marker-' + name, event);
}.bind(this));
},

attributeChanged: function(attrName, oldVal, newVal) {
Expand Down

0 comments on commit 9aba848

Please sign in to comment.