To solve the issue at hand, a simulation of a long click on the specific point is required.
before:
google.maps.event.addListener(this.map, 'rightclick', function (e) {
insert the following code:
/**
* Initiate TIMER to trigger opening of context menu
*/
google.maps.event.addListener(this.map, 'mousedown', function(e) {
var context_menu_element = getElementById('gmaps_context_menu');
document.pressTimer = window.setTimeout(function() {
jQuery(context_menu_element).addClass('mouse_tap');
if (options.rightclick) {
options.rightclick.apply(this, [e]);
}
if (window.context_menu[self.el.id]['map'] != undefined) {
self.buildContextMenu('map', e);
}
},1000);
return false;
});
/**
* Cease TIMER and manage opening or closing of context menu
*/
google.maps.event.addListener(this.map, 'mouseup', function () {
var context_menu_element = getElementById('gmaps_context_menu');
if (jQuery(context_menu_element).hasClass('mouse_tap')){
setTimeout(function () {
context_menu_element.style.display = 'block';
}, 0);
jQuery(context_menu_element).removeClass('mouse_tap');
} else {
this.hideContextMenu;
}
clearTimeout(document.pressTimer);
return false;
});
/**
* Cancel context menu opening when moving the map
*/
var context_menu_with_mouse = ['drag', 'dragend', 'dragstart'];
for (var ev = 0; ev < context_menu_with_mouse.length; ev++) {
(function (object, name) {
google.maps.event.addListener(object, name, function () {
clearTimeout(document.pressTimer);
jQuery(getElementById('gmaps_context_menu')).removeClass('mouse_tap').css('display', 'none');
return false;
});
})(this.map, context_menu_with_mouse[ev] );
}