Gestures and undos

Monday, August 02, 2010

While working on a completely separate issue I happened to notice something interesting in the debugger.

I had selected a figure within Curio and was about to move it with my Magic Mouse when, suddenly, one of Curio's internal logging functions said that a multi-touch gesture has started.

Odd. I didn't intend to do that but I went ahead and clicked then dragged the figure to move it. When I went to undo the move the undo stack reported that it was corrupted. I knew from then on nothing would be recorded correctly to the undo manager.

Why? Because there wasn't a corresponding gesture end so Curio could close the undo group.

An undo group is created to capture the changes that occur with a series of gestures, such as rotating and/or scaling a figure. That way when you undo you will go back to the original angle/scale instead of just the last increment within the gesture.

This odd beginGestureEvent without an endGestureEvent didn't happen every time I used the Magic Mouse but it did happen occasionally. How did I get gestures via my Magic Mouse? BetterTouchTool, which is a very cool beta application for adding functionality including multi-touch gestures to the Magic Mouse.

I disabled BTT which of course got rid of the the issue. And I purchased a Magic Trackpad to verify that beginGestureEvent and endGestureEvents should come in pairs when used with the standard Apple driver, and they do.

If you encounter the odd undo issue with Curio you may see if you have BTT installed and disable it for Curio within BTT's Preferences window.

I sent this information to BTT's developer who seems very responsive, so I'm sure he'll make the necessary tweaks to remedy this behavior in a future release.

I don't mean to imply that this is the only cause for potential undo corruption within Curio, just one I happened to notice. Within the code, I'm fixing any that I find as quickly as possible. They are incredibly difficult to track down.

BTW: the Magic Trackpad is a joy to use. I highly recommend it!