Dropping pins in google maps!
I am a big fan of the google maps on the iphone. I particularly like the way that the little pins drop from above and bounce. I wanted to find a way to do this in the standard google maps, and after a little hacking, I have found a way. Sadly though, the technique detailed here works only with the current version of maps. This is because it interfaces directly with the compressed google code, where the function and variable names are randomised (obscured) with each version increase. Thus, to make this work you need to specify the current version number (2.123) in the map file include.
Anyway, to cut a long story short, I figured, that as you can make markers bounce after you drag them, it should be possible to make them bounce in other situations. I was looking for an function named ‘bounce’ or similar, but it was a bit harder than that! After tracing the flow through the obscured maps code (!) I found that you can drop a marker from above using the following code:
// Make bouncable
if (!marker.Xa)
{
marker.Xa = true;
marker.qo(false);
}
marker.Pa = height; // Current height
marker.ri = height; // Max height
marker.av = 1; // Direction (+ = down)
marker.tc(); // Go baby!
Here is a demo. The markers also ‘hop’ when you move the mouse over them. In the source code there are three functions, dropMarker, hilightMarker and dehilightMarker. Check them out!
Please, please, please google can we make a publicly available ‘bounce’ function?




















September 5th, 2008 at 3:10 pm
brilliant function. Got to make this available for everyone to use.
very fun!
January 19th, 2009 at 10:32 pm
Wow thanks a million for this! I am going to include it in my new iPhone app =)
March 13th, 2009 at 12:10 pm
how can i drag the marker??