예제 #1
0
        public void OnInitializePotentialDrag(PointerEventData eventData)
        {
            ExecuteEvents.ExecuteHierarchy(transform.parent.gameObject, eventData, ExecuteEvents.initializePotentialDrag);

            m_isReady = false;

            Vector2 point;

            if (RectTransformUtility.ScreenPointToLocalPointInRectangle(m_rt, eventData.position, eventData.pressEventCamera, out point))
            {
                Vector2Int coord;
                if (m_pointer.GetKeyframeCoordinate(point, false, false, out coord))
                {
                    m_start1 = new Vector2Int(coord.x, coord.y - 1);
                    m_start2 = new Vector2Int(coord.x, coord.y);

                    if (BeginSelection != null)
                    {
                        TimelineBoxSelectionCancelArgs cancelArgs = new TimelineBoxSelectionCancelArgs(point);
                        BeginSelection(cancelArgs);
                        if (!cancelArgs.Cancel)
                        {
                            m_isReady = true;
                        }
                    }
                    else
                    {
                        m_isReady = true;
                    }
                }
            }
        }
        private void OnBeginBoxSelection(TimelineBoxSelectionCancelArgs args)
        {
            Vector2Int coord;

            if (m_pointer.GetKeyframeCoordinate(args.LocalPoint, true, false, out coord))
            {
                if (TryGetKeyframeWithinRange(coord, m_pointer.Range, out coord))
                {
                    if (Clip.IsSelected(coord.y, coord.x))
                    {
                        args.Cancel = true;
                    }
                }
            }

            if (!args.Cancel)
            {
                m_pointer.IsDragInProgress = false;
            }
        }