Google Maps Update Function

Today I landed a patch I had been working on for roughly 3 months. Now, it's not like I worked on it every day, but it has taken a lot of work to get it done, and I think it really makes the experience of adding a Google Map to a Popcorn Maker project much smoother.

Backing up a bit, Popcorn Maker takes an interesting approach to "updating" an event in a project. When I say updating, what I'm really talking about is changing a setting that the event takes. These settings, more commonly known as options, tell a plugin exactly what to show as well as when to show it.

Using the following plugin definition as an example:
This code sample was lost because Wordpress :/

Were it not to contain an "_update" function, Popcorn Maker would have to copy the settings from and destroy the original event, then recreate the event with the new settings applied to the copied ones. In simple terms, _update is a way to modify important parts of an event without requiring the "_setup" to be run again ( in the above example it doesn't do anything special, but in the case of Google Maps, there's code in the setup function that shouldn't be run twice without tearing down the plugin first.

The patch didn't just add an update method to the plugin. I had to do a lot of work in Popcorn Maker as well. The editor needed to be modified to handle the large amounts of information coming in from the Maps API. For example, if you were to pan across of a map using your mouse, the map API would trigger dozens of events every second. I had to ensure that I didn't overload the app with hundreds of event callbacks, which would cause noticeable performance degradation.

The overall result of this upgrade is a much more fluid experience when editing a map event. No more flickering as you wait for the map to be torn down and recreated. As with any new feature, there may be some kinks related to edge cases, so if you run into any problems, be sure to file a bug!

Below, You can watch an overly-epic popcorn project I made to illustrate the upgrades to the plugin. Be sure to visit http://www.popcorn.webmaker.org/ to try out Popcorn Maker for yourself!

edit: popcorn maker is no longer around, so I've removed the iframe embed that was here.