googlemaps / googlemaps/js-polyline-codec

Can we have a selection choice for setEditable regarding adding new vertices or try to disabled it

Open
#487 1 comment 0 reactions 1 assignee Claimed by @amuramoto View on GitHub
triage me type: feature request
Dominant language
TypeScript
Stars
77
Forks
10
PR merge metrics
No merged PRs in 30d

Description

Thanks for stopping by to let us know something could be better!

---
**PLEASE READ**

If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/). This will ensure a timely response.

Discover additional support services for the Google Maps Platform, including developer communities, technical guidance, and expert support at the Google Maps Platform [support resources page](https://developers.google.com/maps/support/).

If your bug or feature request is not related to this particular library, please visit the Google Maps Platform [issue trackers](https://developers.google.com/maps/support/#issue_tracker).

Check for answers on StackOverflow with the [google-maps](http://stackoverflow.com/questions/tagged/google-maps) tag.

---

**Is your feature request related to a problem? Please describe.**
I have a problem regarding polygon API whenever I tried to use `setEditable` method. since when we try to use this method especially for polygon area marker, the library will give a solution to edit any predefined vertex and automatically show a transparent vertex in the middle of the line between each vertex which is good, but I have stumbled at some of condition where user can only edit a predefined vertex without add any new vertex from any transparent vertex, currently I can use roundabout ways to not store any new vertex and stick to the predefined vertex that I got from our API response, but User experience itself is not good since I can't hide the transparent vertex and user can still add vertex but will not be store to our database, that's why if possible can you add any choice if we want to edit our marker but leave out options to add any new vertex in between the line of each vertex that connected?

![image](https://user-images.githubusercontent.com/28122968/202389137-a2347bfb-1d4b-4bf4-bc82-ff7b3ade20c9.png)

**Describe the solution you'd like**
maybe some params like this would be nice:
`
setEditable({
editable: true,
options: {
addNewVertex: false,
resizeVertex: true,
rotateVertext: true
}
})
`

while `editable` itself from the current polygon params so if we want to have editable feature we set it to `true` and if not we can set it to `false`, meanwhile `options` in here have several feature that can help to customize the polygon area or polyline that we already create. `addNewVertex: Boolean` will give us choice if we want to have editable transparent vertex in the middle of each vertex or not like the image above, `resizeVertex: true` can help user to edit our polygon with scale approach for example to keep the ratio of the original polygon when we move or click the vertex and drag it to upscale the polygon area, and `rotateVertex: Boolean` will help the user to get a shorthand to rotate our predefined vertex without developer need to calculate it manually every time we want to rotate our polygon area

**Describe alternatives you've considered**
for now I use roundabout way to not store any new vertex that user add after click and drag the transparent vertex and only store the predefined value that we got from API response, but with this approach, the user experience will not be good since we got a lot of question as why the system give a new transparent vertex but cannot be add after save

**Additional context**
![image](https://user-images.githubusercontent.com/28122968/202393572-705bd4a3-a242-439b-99eb-dac38ce33a90.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.