コード例 #1
0
    /*
     * OnGUI is called for each event, so OnGUI is potentially called multiple times per frame
     */
    void OnGUI()
    {
        if (ClickingDisabled) // this is set to true when cursor is above some UI
        {
            return;
        }

        MousePosition = Event.current.mousePosition; // let's just try this - YUP, it works - I don't need to test for a mouse event, I can just set the mousePosition always

        //if (!Event.current.alt && MouseLeftClickTest())
        if (MouseLeftClickTest())
        {
            _mouseClicked = true;

            //var selectedInstanceId = NewSelectionManager.Instance.SelectedInstanceId2;
            //InfoTextController.Get.ShowInfoForInstance(selectedInstanceId);

            if (!_firstClickDetected)
            {
                _firstClickDetected = true;
                _firstClickStart    = Time.realtimeSinceStartup;
            }
            else
            {
                if (Time.realtimeSinceStartup <= _firstClickStart + _timeForDoubleClickInS)
                {
                    //Debug.Log("DOUBLE CLICK");
                    _firstClickDetected = false;

                    _cameraController.ZoomInOnSelected();
                }
                else
                {
                    //_firstClickDetected = false;
                    _firstClickStart = Time.realtimeSinceStartup;
                }
            }

            // hide cut object
            var co = CutObjectManager.Get.GetSelectedCutObject();
            co.SetHidden(true);
        }

        if (Event.current.control) // debug - just to free the camera without needing to click into an empty space
        {
            //_selectedInstanceId = -1;
            SelectedProteinInstanceId = -1;
        }
    }