ui-map
ui-map copied to clipboard
Support for drawing tools
I have been using ui-map a lot so far, but now wanted to go a step further, and support polygon or rectangle drawing for arbitrary selections on the map. I copied code from this example:
https://developers.google.com/maps/documentation/javascript/examples/drawing-tools
That roughly works as expected, but I am not sure how to attach to the overlaycomplete event. Adding map-overlaycomplete to the ui-events attribute doesn't seem to do the trick, nor adding it inside the directives. Looks like it is an event on the drawingmanager, not on the map.
I would love to see DrawingManager to get integrated into this directive, with support of at least that overlaycomplete event..
@grtjn , You might want to take a look at the https://angular-ui.github.io/angular-google-maps/ project instead, it has support for the drawing manager and attaching events to it already.
vm.eventHandler = { overlaycomplete: function (dm, name, scope, objs) { console.log("You successfully placed a %s", dm.drawingMode); }, polygoncomplete: function (dm, name, scope, objs) { console.log("You finished drawing polygon to [%s]", objs[0].getPath().getArray().join(",")); } }; And my html is
ui-gmap-drawing-manager options="vm.drawingManagerOptions" control="vm.drawingManagerControl" events="vm.eventHandler" ng-model='item.vm.eventHandler'ui-gmap-drawing-manager
how do i get the array and bind it so that i could save in my db