GoView Zoom Center


#1

Has anyone toyed with the idea of implementing any functionality that will “center” a diagram in a GoView? What i mean by this is given a combination of a keystroke and a mouse click (say “C” + LeftMouseButton) would take your x/y offset and set that as the new center for a Diagram instead of having to zoom and scroll to get the diagram in the desired position - very similar to MapQuest’s “center map” function.
Ideas? Successes?


#2

That should be easy to implement.
Define a GoTool subclass that overrides DoMouseUp, which sets the .View.DocPosition based on .LastInput.DocPoint and .View.DocExtent, and then calls StopTool().
Define a GoView.KeyDown event handler that looks for Keys.C and sets GoView.Tool to an instance of your new tool class.


#3
Hi, Just if anyone needs a reference, I have tried this and I got it to work GoView1.DocScale*=1.25f; GoView1.DocPosition = new PointF( GoView1.LastInput.DocPoint.X - GoView1.DocExtent.Width/2, GoView1.LastInput.DocPoint.Y - GoView1.DocExtent.Height/2); Paul Kinlan