Zn2O / gwt-google-apis

Automatically exported from code.google.com/p/gwt-google-apis
0 stars 0 forks source link

Problems ending a drawing session programmaitcaly #169

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Found in Release:
r290

Detailed description:
From nevin.freeman:

I would like to be able to take control of firing the "endline" and
"cancelline" events that normally fire when a user double-clicks while
drawing a polyline/polygon. When I call:

mapWidget.removeOverlay(polyLine);

before the line has been "ended" or "canceled" It behaves oddly, and I
would like to be able to just trigger the "cancelline" manually at the
same time. How would I do this?

... later, more details about 'oddly' ...

When the line overlay is removed while drawing is still enabled, the
part of the polyline that has been drawn disappears, but the vertex
boxes remain, and the line remains draw-able (ie there is still the
dotted line from the last vertex, and by clicking on the map you can
still add verticies). Upon clicking on the map, the part of the line
that has disappeared will re-appear, and upon double-clicking to end
the line, the endline event is fired. After that though, the polyline
overly is not clickable, and doesn't scale when the map is zoomed.
I've found that I can achieve what I want by calling
setEditingEnabled(false), and then removing the overlay. However, this
still doesn't fire an endline or cancelline event, so no code within
the onCancel or onEnd events is executed.

Currently, there is only the setDrawingEnabled() method, which
optionally accepts a PolyEditingOptions object as a param. With the
setEditingEnabled() method, you can specify enable or disable with a
boolean as a param. It might be good to expose a method that can fire
either of these events. This would mostly be for convenience, so that
one doesn't have to package their onCancel and onEnd code in separate
methods. A possible solution would be to add a setDrawingDisabled()
method (or give setDrawingEnabled() the boolean param for disabling),
and allow the passing of a parameter to fire either an endline or
cancelline event at the time of disabling drawing. I think that this
would only apply during the initial drawing of a line, so not having
access to those events with setEditingEnabled(bool) shouldn't be a
problem.

For the funny situation created by removing the overlay while drawing
is enabled, one can avoid this by calling setEditingEnabled(false)
first, but it might be nice to have this happen automatically, since
there is no case where someone would want to remove the overlay and
have the broken editability functionality left over.

Links to the relevant GWT Developer Forum posts:
http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/6987b2947
99fbd44

Original issue reported on code.google.com by galgwt.reviews@gmail.com on 9 Sep 2008 at 7:07

GoogleCodeExporter commented 9 years ago
cross ref to similar issue in Maps API tracker:
http://code.google.com/p/gmaps-api-issues/issues/detail?id=450

Original comment by galgwt.reviews@gmail.com on 9 Sep 2008 at 7:55

GoogleCodeExporter commented 9 years ago
Next step - reproduce in pure JS and file a ticket for the Maps team.

Original comment by galgwt.reviews@gmail.com on 14 Sep 2008 at 12:01

GoogleCodeExporter commented 9 years ago
Reproduced outside of GWT and submitted to Maps team.  Internal ref: 1376772

Original comment by galgwt.reviews@gmail.com on 15 Sep 2008 at 12:43

GoogleCodeExporter commented 9 years ago
Fixed as of Maps API 2.143.

Original comment by galgwt.reviews@gmail.com on 3 Feb 2009 at 9:53

GoogleCodeExporter commented 9 years ago

Original comment by zundel@google.com on 21 Dec 2009 at 1:57