hi guys,
how do I attach an OS action to an AddMapEvent 'click'? the handler parameter is meant for js.
would anyone be able to post a sample action sequence and the required JS how to put a marker on the map where the mouse has been clicked (or double clicked?)that would be awesome.
thanks.
Hey, Matt,
Google has provided an example on how to create a marker when clicking the Map. This is the part that's relevant:
... map.addListener('click', function(e) { placeMarkerAndPanTo(e.latLng, map); }); } function placeMarkerAndPanTo(latLng, map) { var marker = new google.maps.Marker({ position: latLng, map: map }); map.panTo(latLng); } ...
The highlighted JS function takes in an 'e' argument, which contains the coordinates where the user clicked. Using this, you can use RichWidget's FakeNotifyWidget, as explained here, to invoke a screen action which would add the marker to the map. You will need to pass the coordinates through the "string with the parameters" that's mentioned in this last link.
Hope this helps!