Problems with ZoomToFit

I’m trying to update from GoXam 1.2 to 1.3 and am using the new DiagramPanel.ZoomToFit() method. I’m seeing two problems in my Silverlight application:

  1. The ZoomToFit call results in jumpy animation. Starting with a diagram that has a scale less than 1.0, it looks like the ZoomToFit call (with no parameters) does the following:
- Translate diagram to upper left corner - Clear drawing surface - Position diagram at center of panel - Increase scale using an animation

The initial translation to the upper left corner makes it look a bit jumpy. Is there anything I can do about this effect?

  1. When starting with a diagram at a very small scale (say, 0.1) which is positioned in the center of the visible area, a call to ZoomToFit() often results in a diagram which is off center. Usually the upper left quadrant of the diagram is all that is visible – the user has to pan around to see the remainder. The scale is pretty close (if not absolutely correct). Interestingly, I get the same behavior from my old manual calculation code:

var heightRatio = panel.ActualHeight / panel.DiagramBounds.Height;
var widthRatio = panel.ActualWidth / panel.DiagramBounds.Width;
var ratioToUse = Math.Min(heightRatio, widthRatio);
panel.SetScaleAndPosition(ratioToUse, new Point(0,0), 500, null);

Is there anything I can do to manually correct this situation?

edit: BTW, your GoXam online samples are giving an HTTP 404 again (using address http://www.goxam.com/1.3/Silverlight/GoSilverlightDemo.html).

I’ll investigate.

Where did you get that URL? It should be:
http://www.goxam.com/1.3/Silverlight5/GoSilverlightDemo.html

Using “4” instead of “5” also works, if you want to run the version compiled for Silverlight 4.

That URL came from your website – it was the link to the samples. It appears to have been fixed now.

What version are 1.3 are you using?

I’m using 1.3.4.5
with Silverlight 5.

There seems to be yet another problem with zoom animation.

For now, I suggest you turn it off:
myDiagram.TemplateApplied += (s, e) => {
myDiagram.Panel.ZoomTime = 0;
};

Alas I want the zoom animation. I guess I’ll stick with the manual calculation method for now.