Undo issue with Document Size

I inadvertantly ran into an issue today. I can repeat the problem with the Demo1 sample application. Clear the view and scroll so that there are no scroll bars. Put two nodes on the view. Drag node 2 down and right so that the view auto scrolls until node 1 is no longer visible. Press Ctrl+Z to undo the move. The scroll bars expand to show that the document should fit in the view window. However, nothing is in the display. If you click on any of the scroll buttons, the document is displayed and the scroll bars disappear.

Please let me know if I didn't explain this clearly or if you need any other information to suggest a solution.

I corrected this by adding the following to my DocumentChanged event handler…

if (e.Hint == GoDocument.FinishedUndo || e.Hint == GoDocument.FinishedRedo)
{
if (this.goView1.DocPosition.X > this.goView1.DocumentSize.Width)
{
this.goView1.ScrollLine(-1f, 0f);
}
if (this.goView1.DocPosition.Y > this.goView1.DocumentSize.Height)
{
this.goView1.ScrollLine(0f, -1f);
}
if (this.goView1.DocPosition.X < this.goView1.DocumentTopLeft.X)
{
this.goView1.ScrollLine(1f, 0f);
}
if (this.goView1.DocPosition.Y < this.goView1.DocumentTopLeft.Y)
{
this.goView1.ScrollLine(0f, 1f);
}
}

Yes, the GoUndoManager does not track GoView changes, such as the scroll or zoom (i.e. GoView.DocPosition or GoView.DocScale properties).

It's probably easiest if you just did:
goView1.DocPosition = goView1.LimitDocPosition(goView1.DocPosition);