-
Notifications
You must be signed in to change notification settings - Fork 817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose polygon path in polygon directive #1001
Comments
@seanmcoleman Can you share the code for got the path? I have same problem. |
@seanmcoleman I've installed your version of agm and works fine for me. View:
Controller:
Thanks for your help. |
@seanmcoleman Thanks so much for this! But your code wasn't working with multiple polygons on the map, so IYI, I've forked the current agm and applied your changes with my own at https://github.com/chromacoma/angular-google-maps |
@chromacoma you're right, our use-case only required one polygon so I didn't even consider multiple which was one of the big limitations. Nice fork! |
Please create a Pull request. |
@chromacoma I downloaded your fork and I keep getting a compile error in polygon-manager.ts
Tried the easy way out by just changing createPolygon to return Promise<mapTypes.Polygon> but then I just get more scary errors. I really need the functionality you've implemented! EDIT: When I tried to fix it on that branch, other things broke. Instead I downloaded the dev files from this repo and added in your changes. Seems to be compiling |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
(pathChanged)="onPathChanged($event) its not triggering.now its not working. i have used (polyPathsChange) it also not working..any help |
@commoncoder-02 duplicate of #1801 how are you using the event? how are you triggering it? it only works for editable polylines |
<agm-polygon [paths]="paths" [draggable]="true" [editable]="true" [clickable]="false" (pathChanged)="onPathChanged($event)> |
and how are you triggering it? by dragging and dropping points or by modifying the underlying array? |
modiying the polygon by dragging |
the event is called |
We'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:
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. Themouseup
event guarantees that thepathChanged
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.
The text was updated successfully, but these errors were encountered: