FlowingCode/GoogleMapsAddon

right click on marker

Closed this issue · 2 comments

Hello,
in version 1.6.0
I can't get right click event over marker
(left click is working, but does not give me clickCounts, ctrl, shift, and alt keys)

best regards

paodb commented

Hello, currently the component doesn't have an API to handle right click on markers but the web-component has the event for that (google-map-marker-rightclick) so you could get the right click working with something like this:

marker.getElement().setProperty("clickEvents", true);
marker.getElement().setProperty("clickable", true);
marker.getElement().addEventListener("google-map-marker-rightclick", event -> {
   // do something here         
}).addEventData("event");

The only thing is that this returns a MapMouseEvent and it contains only two fields: domEvent & latLng.

paodb commented

I've investigated this a little bit more and I run into this example that I modified a little bit and shows that is possible to add a rightclick listener to a google map's marker and obtain some data like altKey, ctrlKey, shiftKey and metaKey (for Mac), Window-relative coordinates: clientX/clientY and document-relative coordinates: pageX/pageY. I think that we can implement something similar in our google-maps web component that is the base of this addon. Not sure if it's possible to obtain clickCounts.

google-maps-marker