I want to right click on a node to zoom into that node, then right click again to completely reset the zoom and pan to its starting state. Furthermore, I may in future wish to hide the viewer's built-in toolbar and perform the zoom-out with a hotkey. So "just press the existing Home button" is not a solution for my use case.
I already have the zoom-in working using ShowBBox()
.
I cannot find a way to programmatically zoom out exactly like the Home button would do.
- The viewer has no
ResetZoom()
,HomeButtonPressed()
, or any such method that I can find. - Setting
.ZoomF
back to 1.0 is not sufficient because it does not simultaneous center the panning (andPan(0,0)
does not center the pan either.) gvMain.ShowBBox(gvMain.Graph.BoundingBox)
does not work (the zoom changes very slightly, but not to a fully reset state akin to the Home button.)
CodePudding user response:
What the home button is doing is setting the Transform
to null. So you can also do the same to reset the transform:
//Press home button:
gViewer1.Transform = null;
gViewer1.Invalidate();
Just in case that someone is interested to programmatically invoke the other buttons' operations, here are the methods:
- ZoomInPressed()
- ZoomOutPressed()
- BackwardButtonPressed()
- ForwardButtonPressed()
- SaveButtonPressed()
- PrintButtonPressed()
- OpenButtonPressed()
- UndoButtonPressed()
- RedoButtonPressed()
- LayoutSettingsIsClicked()