Exemple #1
0
            public static WW.Math.Point3D SnapHorizontalOrVertical(
                DxfEntity.Interactor interactor,
                WW.Math.Point3D p,
                InteractionContext context,
                int controlPointIndex)
            {
                bool flag = InputUtil.IsShiftPressed();
                CadInteractionContext interactionContext = context as CadInteractionContext;

                if (interactionContext != null)
                {
                    flag ^= interactionContext.DefaultNonDiagonalLines;
                }
                if (interactor.IsActive && flag)
                {
                    DxfLine         entity   = (DxfLine)interactor.Entity;
                    WW.Math.Point2D point2D1 = context.ProjectionTransform.TransformTo2D(controlPointIndex == 0 ? entity.point3D_1 : entity.point3D_0);
                    WW.Math.Point3D point3D  = p;
                    WW.Math.Point2D point2D2 = context.ProjectionTransform.TransformTo2D((WW.Math.Point2D)point3D);
                    Vector2D        vector2D = point2D2 - point2D1;
                    p = System.Math.Abs(vector2D.X) >= System.Math.Abs(vector2D.Y) ? context.InverseProjectionTransform.TransformTo3D(new WW.Math.Point2D(point2D2.X, point2D1.Y)) : context.InverseProjectionTransform.TransformTo3D(new WW.Math.Point2D(point2D1.X, point2D2.Y));
                }
                return(p);
            }