Random mutterings of Alastair James

OneWheeledBicycle

Dropping pins in google maps!

August 21st, 2008 by alastair

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?

 

3 Responses

  1. Devin Says:

    brilliant function. Got to make this available for everyone to use.

    very fun!

  2. Greg Says:

    Wow thanks a million for this! I am going to include it in my new iPhone app =)

  3. wellinton Says:

    how can i drag the marker??

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.