/// <summary>
        ///     Handle clicks on the item
        /// </summary>
        /// <param name="data">The event data</param>
        public void ItemClick(BaseEventData data)
        {
            // Set the clicked flag
            _clicked = true;

            // Select the item
            var pointerData = (PointerEventData)data;

            if (!hierarchyViewController.IsSelected(this))
            {
                SelectItem();
                _clicked = false;
            }

            // Check what type of click happened
            if (pointerData.button == PointerEventData.InputButton.Left)
            {
                doubleClickDetector.Click();
            }
        }
예제 #2
0
        /// <summary>
        ///     Called after all update methods have been called
        /// </summary>
        private void LateUpdate()
        {
            // Store position when right mouse button is clicked
            if (Input.GetMouseButtonDown(1) && MouseOverViewport)
            {
                _rightClickOverViewport = true;
                StoreLastMousePosition();
            }

            // Reset flag when right mouse button is released
            if (Input.GetMouseButtonUp(1))
            {
                _rightClickOverViewport = false;
            }

            // When right mouse button is held and right click occured over the viewport, rotate the camera
            if (Input.GetMouseButton(1) && _rightClickOverViewport)
            {
                CalculateNewCameraTransform();
            }

            // Focus camera if game object is double clicked
            if (Input.GetMouseButtonUp(0))
            {
                doubleClickDetector.Click();
            }

            // Check for second click
            doubleClickDetector.CheckForSecondClick();

            // Detect scrolling
            if (Input.mouseScrollDelta.y != 0)
            {
                Zoom(Input.mouseScrollDelta.y);
            }
        }