Closed GoogleCodeExporter closed 8 years ago
Original comment by pamela.fox
on 26 Jan 2009 at 8:56
Nicely done. I've checked the code, and i think you missed the zoomend
listener, ill
be testing the code in a bit, see how it handles itself.
Original comment by bbr...@gmail.com
on 26 Jan 2009 at 9:55
Committed in revision 899.
Original comment by bbr...@gmail.com
on 26 Jan 2009 at 10:31
Hello
I didn't miss the "zoomend" listener. Consider this case:
1. You have a SnapToRoute that handles the marker.
2. You call stop on your SnapToRoute object.
3. You zoom in or out.
4. You reactivate by calling restart on your SnapToRoute object.
If you remove the zoomend listener, "loadLineData_" will not be called. When
you reactivate snapping to the route, the
"routePixels_" will be out of sync with the polyline at the current zoom level.
Additionally I noticed strange behaviour after zooming and reactivating if I
removed the zoomend listener.
Last but not least, if you zoom in it may seem as if the marker is not on the
route because of inaccuracies of the
polyline at the previous zoom level.
I would recommend keeping the zoomend listener registered :-)
Regards
Matias Fernandez
Original comment by pisco.ch
on 26 Jan 2009 at 7:06
Hi again
I quickly set up an example.
The in the first example I keep the "zoomend" listener registered:
http://pisco.ch/temp/gmap/snaptoroute/example1.html
In the second example I deregister the listener just as you did:
http://pisco.ch/temp/gmap/snaptoroute/example2.html
I'm sorry this is not a minimal example, didn't have time to strip out all the
unnecessary parts.
Regards
Matias Fernandez
Original comment by pisco.ch
on 26 Jan 2009 at 8:14
Sorry to bother you again. May I suggest adding a call to
this.updateMarkerLocation_(this.marker_.getLatLng());
at the end of SnapToRoute.prototype.loadLineData_? Otherwise, if you stopped
snapping and zoom in, the
marker will be off the road. Observe the effect at:
http://pisco.ch/temp/gmap/snaptoroute/example3.html
I used SnapToRoute.js from r900.
Regards
Matias
Original comment by pisco.ch
on 28 Jan 2009 at 10:18
Original issue reported on code.google.com by
pisco.ch
on 26 Jan 2009 at 8:55Attachments: