public void FlyTo(Rect rect, double newOrientation, TimeSpan delta) { StopFlyTo(); Rect currentRect = DisplayMatrix.MatrixToBounds(this.ZoomMatrix, this.RenderSize); DisplayMatrix temp = DisplayMatrix.BoundsToMatrix(rect, this.RenderSize); Point newCenter = (rect.TopLeft + new Vector(rect.Width / 2, rect.Height / 2)); newCenter = new Point(-newCenter.X, -newCenter.Y); double scaleX = currentRect.Size.Width / rect.Size.Width; double scaleY = currentRect.Size.Height / rect.Size.Height; Vector newScale = this.ZoomMatrix.Scale * Math.Min(scaleX, scaleY); newScale = new Vector(1 / temp.Scale.X, 1 / temp.Scale.Y); AnimateUtility.AnimateElementPoint(this.ZoomMatrix, DisplayMatrix.CenterProperty, newCenter, 0, delta.TotalSeconds); AnimateUtility.AnimateElementVector(this.ZoomMatrix, DisplayMatrix.ScaleProperty, newScale, 0, delta.TotalSeconds); AnimateUtility.AnimateElementDouble(this.ZoomMatrix, DisplayMatrix.OrientationProperty, newOrientation, 0, delta.TotalSeconds); }
private Rect GetBounds() { return(DisplayMatrix.MatrixToBounds(this.Model.DisplayMatrix, this.RenderSize)); }