Пример #1
0
        private void HandleEdgeHover(Edge edge, int segmentIndex)
        {
            if (Event.current.type == EventType.MouseDown)
            {
                if (Event.current.button == 0)
                {
                    _draggingPathPointIndex = edge.GetPathPointIndex(Event.current.mousePosition);
                }
                else
                {
                    _draggingPathPointIndex = -1;
                }

                Event.current.Use();
            }

            if (Event.current.type == EventType.MouseUp)
            {
                if (_draggingPathPointIndex == -1)
                {
                    if (Event.current.button == 0)
                    {
                        edge.AddPathPointAt(Event.current.mousePosition, segmentIndex);
                    }
                    if (Event.current.button == 1)
                    {
                        edge.RemovePathPointAt(Event.current.mousePosition);
                    }
                }
                Event.current.Use();
            }
        }