Exemple #1
0
        protected override void OnToolGUI(Event e)
        {
            CurrentTool.OnGUI(e);

            switch (e.type)
            {
            case EventType.MouseDown when MouseRayValid && e.button == 0:
                IsMouseDown = true;
                IsMouseMove = false;
                CurrentTool.OnMouseDown(e);
                break;

            case EventType.MouseDrag when MouseRayValid:
                IsMouseMove = true;
                CurrentTool.OnMouseDrag(e);
                break;

            case EventType.MouseUp when MouseRayValid && e.button == 0:
                if (IsMouseMove)
                {
                    CurrentTool.OnMouseUp(e);
                }
                else
                {
                    CurrentTool.OnPrimaryMouseClicked(e);
                }
                IsMouseDown = false;
                break;

            case EventType.MouseUp when MouseRayValid && e.button == 1:
                CurrentTool.OnSecondaryMouseClicked();
                break;

            case EventType.KeyUp:
                CurrentTool.OnKeyUp(e);
                break;
            }
        }