Expose polygon path in polygon directive
See original GitHub issueWe’re in need of a way to access a polygon’s path(s) that a user would create and/or edit through the polygon directive. After reviewing the code, it was clear this functionality doesn’t exist yet.
We forked and built this functionality by exposing the polygon in PolygonManager
and then exposing a custom event in the polygon directive for when the polygon is changed, which emits the polygon.
Our solution is bare bones and only supports our use case:
- Only handles a single, non-intersecting path.
- Only exposes an array of points and not the entire polygon itself.
- The directive detects the
mouseup
event to fire apathChanged
event.
For a generalized solution, there may be different design goals. I imagine we would want to handle an arbitrary set of possibly intersecting paths and even possibly return the entire polygon instead of just the points. The mouseup
event was the best event we could find to bind to since I didn’t see that Google Maps supports a true event for if a polygon changed. The mouseup
event guarantees that the pathChanged
event will fire for all changes, but will also fire when it hasn’t changed.
As a first step, I’d like to get a pulse on if this feature makes sense to include in the library (I strongly believe so). Is this the best approach for the functionality? If so, we can invest time in more specific requirements aiming to merge a pull request.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:15 (1 by maintainers)
Top GitHub Comments
@carloscba https://github.com/drawbackwards/angular2-google-maps
Please create a Pull request.