nature_net.MainWindow.workspace_ManipulationDelta C# (CSharp) Метод

workspace_ManipulationDelta() приватный Метод

private workspace_ManipulationDelta ( object sender, System.Windows.Input.ManipulationDeltaEventArgs e ) : void
sender object
e System.Windows.Input.ManipulationDeltaEventArgs
Результат void
        void workspace_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            FrameworkElement element = (FrameworkElement)e.Source;
            if (element == null) return;
            Matrix matrix = ((MatrixTransform)element.RenderTransform).Matrix;
            ManipulationDelta deltaManipulation = e.DeltaManipulation;
            System.Windows.Point center = new System.Windows.Point(element.ActualWidth / 2, element.ActualHeight / 2);
            center = matrix.Transform(center);
            image_frame iframe = null;
            Matrix matrix2 = ((MatrixTransform)element.LayoutTransform).Matrix;
            try
            {
                iframe = (image_frame)element;
                matrix2.ScaleAt(deltaManipulation.Scale.X, deltaManipulation.Scale.Y, e.ManipulationOrigin.X, e.ManipulationOrigin.Y);
            }
            catch (Exception) { }

            matrix.RotateAt(e.DeltaManipulation.Rotation, e.ManipulationOrigin.X, e.ManipulationOrigin.Y);// center.X, center.Y);
            //if (element.PointToScreen(new System.Windows.Point(0, 0)).X > 300 && e.DeltaManipulation.Translation.X > 0)
                matrix.Translate(e.DeltaManipulation.Translation.X, e.DeltaManipulation.Translation.Y);
            element.RenderTransform = new MatrixTransform(matrix);
            if (iframe != null)
            {
                //iframe.Width = iframe.Width * deltaManipulation.Scale.X;
                //iframe.Height = iframe.Height * deltaManipulation.Scale.X;
                iframe.the_item.Width = iframe.the_item.Width * deltaManipulation.Scale.X;
                iframe.the_item.Height = iframe.the_item.Height * deltaManipulation.Scale.X;
                //iframe.whole.Height = iframe.whole.Height * deltaManipulation.Scale.X;

                iframe.title_bar.Height = configurations.frame_title_bar_height;
                iframe.close.Height = 33;
                iframe.close.Width = 33;
                iframe.UpdateLayout();
            }
            num_updates++;
            if (num_updates > configurations.max_num_content_update)
            {
                num_updates = 0;
                try { user_controls.window_frame w1 = (user_controls.window_frame)element; w1.UpdateContents(); }
                catch (Exception) { }
                try { user_controls.image_frame w2 = (user_controls.image_frame)element; w2.UpdateContents(); }
                catch (Exception) { }
            }
        }