You can define a context menu (which will show on right click) with:
map.setContextMenu({
control: 'map',
options: [{
title: 'Add marker',
name: 'add_marker',
action: function(e){
this.addMarker({
lat: e.latLng.lat(),
lng: e.latLng.lng(),
title: 'New marker'
});
}
}, {
title: 'Center here',
name: 'center_here',
action: function(e){
this.setCenter(e.latLng.lat(), e.latLng.lng());
}
}]
});
You must define the control that the context menu is attached ( map or marker) and an array of options with title , name and action Inside action you can use this for the GMaps.js object ( map in this case) and MouseEvent object e .