Пример #1
0
 public void OnEnterDrag(IEnumerable <ITimelineItem> items, WindowState state)
 {
     if (items.Any())
     {
         m_MoveItemHandler = new MoveItemHandler(state);
         m_MoveItemHandler.Grab(items, items.First().parentTrack);
     }
 }
Пример #2
0
            public static void SetValueForEdge(IEnumerable <ITimelineItem> items, AttractedEdge edge, double value, WindowState state)
            {
                var handler = new MoveItemHandler(state);

                foreach (var item in items)
                {
                    handler.Grab(new[] { item }, item.parentTrack);
                    handler.OnAttractedEdge(null, ManipulateEdges.Both, edge, value);
                    handler.Drop();
                }
            }
Пример #3
0
            public void OnSetValue(IEnumerable <ITimelineItem> items, double value, WindowState state)
            {
                if (!items.Any())
                {
                    return;
                }

                m_MoveItemHandler = new MoveItemHandler(state);
                m_MoveItemHandler.Grab(items, items.First().parentTrack);
                m_MoveItemHandler.OnAttractedEdge(null, ManipulateEdges.Both, AttractedEdge.None, value);
                m_MoveItemHandler.Drop();
                m_MoveItemHandler = null;
            }
Пример #4
0
        protected override bool MouseDrag(Event evt, WindowState state)
        {
            if (state.editSequence.isReadOnly)
            {
                return(false);
            }

            // case 1099285 - ctrl-click can cause no clips to be selected
            var selectedItemsGUI = SelectionManager.SelectedItems();

            if (!selectedItemsGUI.Any())
            {
                m_Dragged = false;
                return(false);
            }

            const float hDeadZone = 5.0f;
            const float vDeadZone = 5.0f;

            bool vDone = m_VerticalMovementDone || Math.Abs(evt.mousePosition.y - m_MouseDownPosition.y) > vDeadZone;
            bool hDone = m_HorizontalMovementDone || Math.Abs(evt.mousePosition.x - m_MouseDownPosition.x) > hDeadZone;

            m_CycleMarkersPending = false;

            if (!m_Dragged)
            {
                var canStartMove = vDone || hDone;

                if (canStartMove)
                {
                    state.AddCaptured(this);
                    m_Dragged = true;

                    var referenceTrack = GetTrackDropTargetAt(state, m_MouseDownPosition);

                    foreach (var item in selectedItemsGUI)
                    {
                        item.gui.StartDrag();
                    }

                    m_MoveItemHandler = new MoveItemHandler(state);

                    m_MoveItemHandler.Grab(selectedItemsGUI, referenceTrack, m_MouseDownPosition);

                    m_SnapEngine = new SnapEngine(m_MoveItemHandler, m_MoveItemHandler, ManipulateEdges.Both,
                                                  state, m_MouseDownPosition);

                    m_TimeAreaAutoPanner = new TimeAreaAutoPanner(state);
                }
            }

            if (!m_VerticalMovementDone)
            {
                m_VerticalMovementDone = vDone;

                if (m_VerticalMovementDone)
                {
                    m_MoveItemHandler.OnTrackDetach();
                }
            }

            if (!m_HorizontalMovementDone)
            {
                m_HorizontalMovementDone = hDone;
            }

            if (m_Dragged)
            {
                if (m_HorizontalMovementDone)
                {
                    m_SnapEngine.Snap(evt.mousePosition, evt.modifiers);
                }

                if (m_VerticalMovementDone)
                {
                    var track = GetTrackDropTargetAt(state, evt.mousePosition);
                    m_MoveItemHandler.UpdateTrackTarget(track);
                }

                state.Evaluate();
            }

            return(true);
        }