This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, I would like to center a diagram within the diagram surface and zoom out sufficently such that all nodes are visible. I have attempted to do this using ds.ScrollViewer.SetViewport(ds.DiagramBounds), however after this operation when the user clicks the canvas the diagram begins to move down and to the right as though panning. This repeats for about 8 clicks after which it remains still as expected. Any help understanding this behaviour would be appreciated. Kind Regards, Adam |
|
|
Just to note also that the same effect can be achieved using: ds.Zoom = Math.Min(ds.ActualWidth / ds.DiagramBounds.Width, ds.ActualHeight / ds.DiagramBounds.Height) / 1.1;
When the user begins clicking the canvas it moves for no reason sideways towards the bottom right of the screen? |
|
|
Hello I have tried this but was unable to reproduce the problem. Are you wanting to fit the diagram to the viewport based on a user clicking a button or some other logic? If so, you can use the DiagramSurface.SizeToFit method instead. Or are you wanting to fit the diagram to the viewport in real time as the user modifies the diagram? If so, you can set the DiagramSurface.ZoomMode to be 'SizeToFit'. Let us know how it goes |
|