Beispiel #1
0
        void OnZoom(InputAction.CallbackContext context)
        {
            if (m_IsBlocked)
            {
                return;
            }

            if (CheckTreatInput(context))
            {
                if (m_CachedToolType != ToolType.ZoomTool)
                {
                    return;
                }

                m_ZoomDelta.SetNewFrameDelta(context.ReadValue <Vector2>());
                Zoom(m_ZoomDelta.delta);
            }
        }
Beispiel #2
0
        void OnPan(InputAction.CallbackContext context)
        {
            if (m_IsBlocked)
            {
                return;
            }

            if (CheckTreatInput(context))
            {
                if (m_CachedToolType != ToolType.PanTool)
                {
                    return;
                }

                m_PanDelta.SetNewFrameDelta(context.ReadValue <Vector2>());
                var delta = m_PanDelta.delta * -Vector2.one;
                Pan(delta);
            }
        }
Beispiel #3
0
        void OnOrbit(InputAction.CallbackContext context)
        {
            if (m_IsBlocked)
            {
                return;
            }

            if (CheckTreatInput(context))
            {
                if (m_CachedToolType != ToolType.OrbitTool)
                {
                    return;
                }

                m_WorldOrbitDelta.SetNewFrameDelta(context.ReadValue <Vector2>());
                var delta       = m_WorldOrbitDelta.delta;
                var worldVector = new Vector2(delta.x, -delta.y);
                Orbit(worldVector);
            }
        }
        void OnQuickZoom(InputAction.CallbackContext context)
        {
            if (OrphanUIController.isPointBlockedByUI)
            {
                return;
            }

            if (CheckTreatInput(context))
            {
                m_ZoomDelta.SetNewFrameDelta(context.ReadValue <Vector2>());
                Zoom(m_ZoomDelta.delta);
            }
        }
        void OnPanGesture(InputAction.CallbackContext context)
        {
            if (OrphanUIController.isTouchBlockedByUI || m_ZoomGestureInProgress || !CheckTreatInput(context))
            {
                return;
            }

            var interaction = context.interaction as TwoFingerDragGestureInteraction;

            if (interaction?.currentGesture != null)
            {
                var dragGesture = interaction?.currentGesture as TwoFingerDragGesture;
                if (m_PanGestureCoroutine != null)
                {
                    StopCoroutine(m_PanGestureCoroutine);
                }
                m_PanGestureCoroutine = StartCoroutine(StopPanGesture());
                m_PanDelta.SetNewFrameDelta(dragGesture.Delta);
                var delta = dragGesture.Delta * -Vector2.one;
                Pan(delta);
            }
        }
        void OnOrbit(InputAction.CallbackContext context)
        {
            if (OrphanUIController.isTouchBlockedByUI ||
                m_ZoomGestureInProgress || m_PanGestureInProgress || !CheckTreatInput(context))
            {
                return;
            }

            var readValue = context.ReadValue <Vector2>();

            m_WorldOrbitDelta.SetNewFrameDelta(readValue);
            var delta       = m_WorldOrbitDelta.delta;
            var worldVector = new Vector2(delta.x, -delta.y);

            if (m_DeviceCapability.HasFlag(SetVREnableAction.DeviceCapability.ARCapability))
            {
                Orbit(worldVector, m_TouchOrbitType);
            }
            else
            {
                Orbit(worldVector, SetOrbitTypeAction.OrbitType.OrbitAtPoint);
            }
        }