question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Expose polygon path in polygon directive

See original GitHub issue

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:

  • 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 a pathChanged 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:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:15 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
agustinbcu01commented, Aug 29, 2017

Please create a Pull request.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Expose polygon path in polygon directive · Issue #1001 - GitHub
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.
Read more >
Listening to `set_at` event using the ui-gmap-polygon
I'm currently using the DrawingManager to allow users to draw shapes on the map. Once a shape is drawn, I set up a...
Read more >
Exercise 1d: Creating new polygon features
You could snap to every vertex, but an easier way is to use the Auto-Complete Polygon tool, which uses the geometry of existing...
Read more >
AgmPolygon - @agm/core
Unlike polylines, a polygon may consist of one or more paths. As a result, the paths property may specify one or more arrays...
Read more >
2013 Polygon Owner's Manual by POLYGON BIKES - Issuu
Danger Here, life and health may be exposed to danger. ... The knee should be directly above the axle of the front pedal....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found