Reputation: 3702
I need to be able to manually trigger a mouse click and have that mouse click perform normal actions on Google maps. For instance, I would want to call google.maps.event.trigger(map, "dblclick", event)
(where event
is a normal mouse event object) and have it zoom in, as that is standard double click behavior.
Calling that exact code does trigger the doubleclick event on the map (verified by adding a listener to the map), but it does not trigger standard actions. My guess is that Google does not internally use those events for their built in actions. Any help would be greatly appreciated.
Edit:
Example case: I want to bind the right-click to perform whatever the current double-click action is.
...
google.maps.event.addListener(map, "rightclick", rightClick);
...
function rightClick(mouseEvent) {
google.maps.event.trigger(map, "dblclick", mouseEvent);
}
In this case I'd want a right click to zoom in when in the normal mode, to complete a polygon when in polygon draw mode, etc.
Upvotes: 1
Views: 1371
Reputation: 3702
Google's obfuscated source for the JS library reveals that there is no way to trigger the desired functionality programmatically.
Upvotes: -1