bradcornford / Googlmapper

An easy way to integrate Google Maps with Laravel
MIT License
464 stars 142 forks source link

right click context menu #227

Open phpgraham opened 6 years ago

phpgraham commented 6 years ago

Not an issue, more a request..

Is there a way to easily add ability to do a right click context menu, eg: would like to add this using your code style, so that it becomes another option with definable features. I've used this method before to add polygons, circles, markers, center here options at point of right click.

an example of context menu is here: https://github.com/gizzmo/Gmaps-Context-Menu

so far i have amended the map.blade.php file adding the following to the initialize function: /* Create the menu and attached it to the map / var menu = new contextMenu({map:map_{!! $id !!}}); // Add some items to the menu menu.addItem('Zoom In', function(map, latLng){ map.setZoom( map.getZoom() + 1); map.panTo( latLng ); }); menu.addItem('Zoom Out', function(map, latLng){ map.setZoom( map.getZoom() - 1 ); map.panTo(latLng); }); menu.addItem('Create Polygon', function(map, latLng){ // TODO - add code to start editable polygon here }); menu.addItem('Create Circle', function(map, latLng){ // TODO - add code to create editable circle here }); menu.addItem('Add Marker', function(map, latLng){ // TODO - add code to create marker here }); menu.addSep(); menu.addItem('Center Here', function(map, latLng){ map.panTo(latLng); });

then including the js and css files to my app.blade.php file that worked the context menu appears, would be nice to fully integrate this with your code to be more definable via config arrays

bradcornford commented 6 years ago

Hi there,

This looks interesting, I'll take a look into this and see if its something that fits nicely into this package.