Zn2O / gwt-google-apis

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

MapClickEvent and Timer #150

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Found in Release:

Trunk, built on 2008-07-11 at 10:59pm

Detailed description:

I want to implement a Timer to handle both onClick and doubleClick events
in order to properly draw and edit a polyline interactively, as found in
http://gmaps-samples.googlecode.com/svn/trunk/poly/mymapstoolbar.html. 

To do this in GWT:

1) I have a PolylineMapClickHandler to handle the onClick events to add
vertices to the polyline.

2) I have a PolylineMapDoubleClickHandler to handle the doubleClick events
to add the last vertex and "close the loop" on the polyline.

In the PolylineMapClickHandler.onClick method, I wrap an onClickDelay (that
draws the vertex in question) with a 2 second Timer delay. I expect that
each single click I give on the map is delayed 2 seconds before adding the
vertex, which it is.

In the PolylineMapDoubleClickHandler.onDoubleClick method, I cancel the
scheduled Timer, and close the loop on the polyline. I expect that the
single-click event (which draws another leg of the polyline) will NOT fire,
but even after a 2 second delay it does fire, adding an extra line and
vertex to my polyline.

Perhaps I have coded the timer improperly, or expect it to work within
onClick and doubleClick events when it really does not? 

Attached is my eclipse project (same code as Issue 149). If you fix up the
classpaths and launch it, try to create a square with the polyline tool by
double clicking on your third vertex to close the poly. Watch the GWT shell
for logs that indicate the Timer is not cancelled properly.

Environment: Mac OS X 10.4.11
GWT Build: From trunk, 2008-07-11 at 10:59pm
GWT-Maps build: Same as GWT build

Workaround if you have one:

None.

Links to the relevant GWT Developer Forum posts:

None.

Original issue reported on code.google.com by stuartmo...@gmail.com on 12 Jul 2008 at 10:25

Attachments:

GoogleCodeExporter commented 9 years ago
Have you seen the latest setEditable() and setDrawing() methods added to 
Polyline and
Polygon?  If you grab and compile the latest trunk, you'll see a 
"DrawingDemo.java"
that uses these new features.  It basically implements interactive drawing much 
like
what you are talking about.

Original comment by galgwt.reviews@gmail.com on 12 Jul 2008 at 10:44

GoogleCodeExporter commented 9 years ago
It sounds like Eric's setEditable/setDrawing suggestion will give you what you 
want.  Please reopen this issue if 
that is not the case.

Original comment by mmendez+personal@google.com on 23 Jul 2008 at 2:55