Пример #1
0
        public void Started(Vector2 startingPoint, Vector2 point)
        {
            if (this.CurveLayer == null)
            {
                this.Mode = NodeCollectionMode.Preview;
            }
            else
            {
                this.Mode = NodeCollectionMode.Add;
            }

            switch (this.Mode)
            {
            case NodeCollectionMode.None:
                break;

            case NodeCollectionMode.Preview:
                this.PreviewStart(startingPoint);
                break;

            case NodeCollectionMode.Add:
                this.AddStart();
                break;
            }
        }
Пример #2
0
        public void Complete(Vector2 startingPoint, Vector2 point, bool isOutNodeDistance)
        {
            Matrix3x2 inverseMatrix       = this.ViewModel.CanvasTransformer.GetInverseMatrix();
            Vector2   canvasStartingPoint = Vector2.Transform(startingPoint, inverseMatrix);
            Vector2   canvasPoint         = Vector2.Transform(point, inverseMatrix);

            switch (this.Mode)
            {
            case NodeCollectionMode.None:
                break;

            case NodeCollectionMode.Preview:
                this.PreviewComplete(canvasStartingPoint, canvasPoint, isOutNodeDistance);    //PreviewNode
                break;

            case NodeCollectionMode.Add:
            {
                if (this.CurveLayer != null)
                {
                    this.AddComplete(canvasPoint);
                }
            }
            break;
            }

            this.Mode = NodeCollectionMode.None;
        }
Пример #3
0
        private Layerage GetNodeCollectionLayer(Vector2 startingPoint, Matrix3x2 matrix)
        {
            switch (this.SelectionMode)
            {
            case ListViewSelectionMode.None: return(null);

            case ListViewSelectionMode.Single:
            {
                Layerage layerage = this.SelectionViewModel.SelectionLayerage;
                if (layerage == null)
                {
                    return(null);
                }
                ILayer layer = layerage.Self;

                if (layer.Type == LayerType.Curve)
                {
                    layer.Nodes.CacheTransform();
                    this.NodeCollectionMode = NodeCollection.ContainsNodeCollectionMode(startingPoint, layer.Nodes, matrix);
                    return(layerage);
                }
            }
            break;

            case ListViewSelectionMode.Multiple:
                foreach (Layerage layerage in this.SelectionViewModel.SelectionLayerages)
                {
                    ILayer layer = layerage.Self;

                    if (layer.Type == LayerType.Curve)
                    {
                        layer.Nodes.CacheTransform();
                        NodeCollectionMode mode = NodeCollection.ContainsNodeCollectionMode(startingPoint, layer.Nodes, matrix);
                        if (mode != NodeCollectionMode.None)
                        {
                            this.NodeCollectionMode = mode;
                            return(layerage);
                        }
                    }
                }
                break;
            }
            return(null);
        }
        public void Complete(Vector2 startingPoint, Vector2 point, bool isOutNodeDistance)
        {
            Matrix3x2 inverseMatrix       = this.ViewModel.CanvasTransformer.GetInverseMatrix();
            Vector2   canvasStartingPoint = Vector2.Transform(startingPoint, inverseMatrix);
            Vector2   canvasPoint         = Vector2.Transform(point, inverseMatrix);

            if (this.Layerage == null)
            {
                this.TransformerRect    = new TransformerRect(canvasStartingPoint, canvasPoint);
                this.NodeCollectionMode = NodeCollectionMode.None;
                this.ViewModel.Invalidate(InvalidateMode.HD);//Invalidate
                return;
            }

            if (isOutNodeDistance)
            {
                switch (this.NodeCollectionMode)
                {
                case NodeCollectionMode.Move:
                    this.MoveComplete(canvasStartingPoint, canvasPoint);
                    break;

                case NodeCollectionMode.MoveSingleNodePoint:
                    this.MoveSingleNodePointComplete(canvasPoint);
                    break;

                case NodeCollectionMode.MoveSingleNodeLeftControlPoint:
                    this.MoveSingleNodeControlPointComplete(canvasPoint, isLeftControlPoint: true);
                    break;

                case NodeCollectionMode.MoveSingleNodeRightControlPoint:
                    this.MoveSingleNodeControlPointComplete(canvasPoint, isLeftControlPoint: false);
                    break;

                case NodeCollectionMode.RectChoose:
                    this.RectChooseComplete(canvasStartingPoint, canvasPoint);
                    break;
                }
            }

            this.NodeCollectionMode = NodeCollectionMode.None;

            this.ViewModel.Invalidate(InvalidateMode.HD);//Invalidate
        }
        public void Started(Vector2 startingPoint, Vector2 point)
        {
            Matrix3x2 matrix = this.ViewModel.CanvasTransformer.GetMatrix();

            this.Layerage = this.GetNodeCollectionLayer(startingPoint, matrix);
            if (this.Layerage == null)
            {
                Matrix3x2 inverseMatrix       = this.ViewModel.CanvasTransformer.GetInverseMatrix();
                Vector2   canvasStartingPoint = Vector2.Transform(startingPoint, inverseMatrix);
                Vector2   canvasPoint         = Vector2.Transform(point, inverseMatrix);

                this.TransformerRect    = new TransformerRect(canvasStartingPoint, canvasPoint);
                this.NodeCollectionMode = NodeCollectionMode.RectChoose;
                this.ViewModel.Invalidate(InvalidateMode.Thumbnail);//Invalidate
                return;
            }

            switch (this.NodeCollectionMode)
            {
            case NodeCollectionMode.Move:
                this.MoveStarted();
                break;

            case NodeCollectionMode.MoveSingleNodePoint:
                this.MoveSingleNodePointStarted(startingPoint, matrix);
                break;

            case NodeCollectionMode.MoveSingleNodeLeftControlPoint:
            case NodeCollectionMode.MoveSingleNodeRightControlPoint:
                this.MoveSingleNodeControlPointStarted();
                break;

            case NodeCollectionMode.RectChoose:
                this.RectChooseStarted(startingPoint, point);
                break;
            }

            this.ViewModel.Invalidate(InvalidateMode.Thumbnail);//Invalidate
        }