Ejemplo n.º 1
0
        public void OnGUI(Event evt)
        {
            if (evt.type != EventType.Layout)
            {
                return;
            }

            var hFactor = 0.0f;
            var vFactor = 0.0f;

            bool horizontalPan = GetPanFactor(evt.mousePosition.x, m_ViewRect.xMin, m_ViewRect.xMax, out hFactor);
            bool verticalPan   = GetPanFactor(evt.mousePosition.y, m_ViewRect.yMin, m_ViewRect.yMax, out vFactor);

            if (horizontalPan)
            {
                var translation = m_State.timeAreaTranslation;
                translation.x += hFactor * k_MaxPanSpeed;

                m_State.SetTimeAreaTransform(translation, m_State.timeAreaScale);
            }

            if (verticalPan)
            {
                var translation = m_Window.treeView.scrollPosition;
                translation.y -= vFactor * k_MaxPanSpeed;

                m_Window.treeView.scrollPosition = translation;
            }
        }