Esempio n. 1
0
        /// <summary>
        /// Fit Size ViewBox
        /// </summary>
        /// <param name="viewBox"></param>
        private void FitViewBoxSize(BoundingRectangle viewBox)
        {
            if (viewBox == null)
            {
                return;
            }

            if (viewBox.IsEmpty())
            {
                return;
            }

            double dx = 0;
            double dy = 0;

            if (ActualWidth / ActualHeight > viewBox.Width / viewBox.Height)
            {
                dy = -(viewBox.Height - ActualHeight / ActualWidth * viewBox.Width);
            }
            else
            {
                dx = -(viewBox.Width - ActualWidth / ActualHeight * viewBox.Height);
            }

            // Sets a bounds of all shapes in file
            viewBox.SetBounds(viewBox.MinX, viewBox.MinY, viewBox.MaxX + dx, viewBox.MaxY + dy);
        }
Esempio n. 2
0
        /// <summary>
        /// Fit Size ViewBox
        /// </summary>
        /// <param name="viewBox"></param>
        private void FitViewBoxSize(BoundingRectangle viewBox)
        {
            if (viewBox == null)
                return;

            if (viewBox.IsEmpty())
                return;

            double dx = 0;
            double dy = 0;

            if (ActualWidth / ActualHeight > viewBox.Width / viewBox.Height)
                dy = -(viewBox.Height - ActualHeight / ActualWidth * viewBox.Width);
            else
                dx = -(viewBox.Width - ActualWidth / ActualHeight * viewBox.Height);

            // Sets a bounds of all shapes in file
            viewBox.SetBounds(viewBox.MinX, viewBox.MinY, viewBox.MaxX + dx, viewBox.MaxY + dy);
        }