1. How to capture the index id of a polygon's vertex when clicking on
a vertex of a polygon? I want to use this to delete verteces by
clicking on them.
2. What event is fired if a polygon has been changed, ie by dragging a
vertex?
Both the above questions refer to polygons which have been set to
"setEditable(true)".
1. How to capture the index id of a polygon's vertex when clicking on
a vertex of a polygon? I want to use this to delete verteces by
clicking on them.
2. What event is fired if a polygon has been changed, ie by dragging a
vertex?
Is there any way you can think of which would allow me to delete
vertexes by clicking on them? Or is Google working at exposing the
vertex-clicking event?
Adrien
On Nov 20, 4:01 pm, "Enoch Lau (Google Employee)"
<enoch...@google.com> wrote:
> > 1. How to capture the index id of a polygon's vertex when clicking on
> > a vertex of a polygon? I want to use this to delete verteces by
> > clicking on them.
>
> There is currently no event fired when a user clicks on a control point on
> an editable polygon.
>
> > 2. What event is fired if a polygon has been changed, ie by dragging a
> > vertex?
>
> http://code.google.com/apis/maps/documentation/javascript/overlays.ht...
Right click anywhere to delete the closest node:
http://maps.forum.nu/v3/gm_editable_polygon.html
You can add a threshold if you like, so that the node only gets
deleted if the click takes place at a distance below that threshold.
--
Marcelo - http://maps.forum.nu
--
@Marcelo, very interesting, but this will not work with v3 of the
GMaps, or am I mistaken?
Adrien
On Nov 21, 3:21 pm, Marcelo <marcelo...@hotmail.com> wrote:
> On Nov 21, 2:42 am, Adrien <ahing...@gmail.com> wrote:
>
> > Is there any way you can think of which would allow me to delete
> > vertexes by clicking on them?
>
> Right click anywhere to delete the closest node:http://maps.forum.nu/v3/gm_editable_polygon.html
>
> You can add a threshold if you like, so that the node only gets
> deleted if the click takes place at a distance below that threshold.
>
> --
> Marcelo -http://maps.forum.nu
Huh? What version did I use in the demo?
--
Marcelo - http://maps.forum.nu
--
As far as I can see, if I can change this to a left click I have my
solution.
Adrien
On Nov 21, 7:41 pm, Marcelo <marcelo...@hotmail.com> wrote:
> On Nov 21, 11:32 am, Adrien <ahing...@gmail.com> wrote:
>
>
>
> > @Marcelo, very interesting, but this will not work with v3 of the
> > GMaps, or am I mistaken?
>
> Huh? What version did I use in the demo?
>
> --
> Marcelo -http://maps.forum.nu
Because the polygon has clickable: false.
If you set clickable: true then the polygon will absorb the click and
it will not go through to the map.
Note that the rightclick event is attached to the map, and not to the
polygon.
--
Marcelo - http://maps.forum.nu
--
>
Adrien
On Nov 21, 8:56 pm, Marcelo <marcelo...@hotmail.com> wrote:
> On Nov 21, 12:30 pm, Adrien <ahing...@gmail.com> wrote:
>
> > I tested it and it works great. I have one question though: why does
> > rightclicking on the vertex actually fire the click, while changing
> > the venet from "rightclick" to "click" will not fire the event on the
> > vertex?
>
> Because the polygon has clickable: false.
> If you set clickable: true then the polygon will absorb the click and
> it will not go through to the map.
> Note that the rightclick event is attached to the map, and not to the
> polygon.
>
> --
> Marcelo -http://maps.forum.nu
As Enoch already told you "There is currently no event fired when a
user clicks on a control point on an editable polygon.", so no, there
is no way to do it with the events that are currently exposed.
But everything is possible! You can climb the DOM tree, find the DIVs
that represent the nodes and attach event handlers to them, but the
code will likely break when Google release future versions of the API,
as there is no guarantee that the DOM tree structure will remain the
same.
--
Marcelo - http://maps.forum.nu
But everything is possible! You can climb the DOM tree, find the DIVs
that represent the nodes and attach event handlers to them, but the
code will likely break when Google release future versions of the API,
as there is no guarantee that the DOM tree structure will remain the
same.
On Nov 21, 11:48 pm, "Enoch Lau (Google Employee)"