fast_dnd

March 1st, 2007

The Script.aculo.us drag and drop code is really very nice. Unfortunately, it starts to slow down when you have more than 30 droppables on the page. I thought it would be fun to do something about that, so I did.

This is one of the few times I’ve ever been able to directly apply any of the knowledge I’ve accumulated about how game engines work. Drag and drop is just a collision detection problem, and spatial indexing is a very simple way to optimize it.

In general I consider my experiment to be a success. The test file is noticeably more responsive when using the optimization. I do wish that it didn’t have to rebuild the entire index so often, or at least that the rebuild could be run in a thread, but we’re up against the limitations of the browser.

Sorry, comments are closed for this article.