Compositing text modifications with font size modifications for undo
Hey TLF gurus,
So here's my situation. I have a text flow. The user starts typing "The lazy brown dog..." and after each character is typed I'm modifying the font size of all the text to make it fit inside the container. Here's how I'm doing that: http://aaronhardy.com/flex/size-text-to-container/ (you can right-click the app to see the source).
That all works well, but undo isn't working so well. When I hit undo, I would like it to remove the text. But when I call undo on the undo manager, it gets to EditManager.performUndo() where it checks to see if operation.endGeneration is different than textFlow.generation. In my case, they aren't the same because I updated the font size after the last keystroke. Because they're different, the undo fails. Because I updated the font size after the last text insert, TextFlow.processModelChanged() was called and increased the text flow's generation while the insert text operation's end generation stayed the same.
Ultimately I think I want to create a composite operation that contains any text modifications with their following text auto-sizing. Either that or I want to prevent my font auto-sizing operation from affecting the text flow generation. Either way, I'm not sure how to go about pulling it off. I'm sure I can make some sweet hacks but I'd really appreciate some guidance. Thanks.
Aaron
