コード例 #1
0
        public static ISelectable HandleSingleSelection(Event evt)
        {
            var item = PickerUtils.PickedSelectable();

            if (item != null)
            {
                var selected = item.IsSelected();
                if (!selected && CanClearSelection(evt))
                {
                    SelectionManager.Clear();
                }

                if (evt.modifiers == EventModifiers.Shift)
                {
                    if (!selected)
                    {
                        RangeSelectItems((item as TimelineItemGUI).item);
                    }
                }
                else
                {
                    HandleItemSelection(evt, item);
                }
            }

            return(item);
        }
コード例 #2
0
        void SelectionChangedCallback(int[] ids)
        {
            if (Event.current.button == 1)
            {
                var selectableItem = PickerUtils.PickedSelectable();
                if (selectableItem != null)
                {
                    return;
                }
            }

            if (Event.current.command || Event.current.control || Event.current.shift)
            {
                SelectionManager.UnSelectTracks();
            }
            else
            {
                SelectionManager.Clear();
            }

            foreach (var id in ids)
            {
                var trackGUI = (TimelineTrackBaseGUI)m_TreeView.FindItem(id);
                SelectionManager.Add(trackGUI.track);
            }

            m_State.GetWindow().Repaint();
        }
コード例 #3
0
        protected override bool ContextClick(Event evt, WindowState state)
        {
            if (evt.alt)
            {
                return(false);
            }

            var selectable = PickerUtils.PickedSelectable();

            if (selectable != null && selectable.IsSelected())
            {
                SequencerContextMenu.ShowItemContextMenu(evt.mousePosition);
                return(true);
            }

            var trackGUI = PickerUtils.PickedTrackBaseGUI();

            if (trackGUI != null)
            {
                SelectionManager.SelectOnly(trackGUI.track);
                trackGUI.drawer.trackMenuContext.clipTimeCreation = TrackDrawer.TrackMenuContext.ClipTimeCreation.Mouse;
                trackGUI.drawer.trackMenuContext.mousePosition    = evt.mousePosition;
                trackGUI.DisplayTrackMenu();
                return(true);
            }

            return(false);
        }
コード例 #4
0
        protected override bool MouseUp(Event evt, WindowState state)
        {
            if (!m_Dragged)
            {
                var item = PickerUtils.PickedSelectable();

                if (item == null)
                {
                    return(false);
                }

                if (!item.IsSelected())
                {
                    return(false);
                }

                // Re-selecting an item part of a multi-selection should only keep this item selected.
                if (SelectionManager.Count() > 1 && ItemSelection.CanClearSelection(evt))
                {
                    SelectionManager.Clear();
                    item.Select();
                    return(true);
                }

                if (m_CycleMarkersPending)
                {
                    m_CycleMarkersPending = false;
                    TimelineMarkerClusterGUI.CycleMarkers();
                    return(true);
                }

                return(false);
            }

            m_TimeAreaAutoPanner = null;

            DropItems();

            m_SnapEngine      = null;
            m_MoveItemHandler = null;

            state.Evaluate();
            state.RemoveCaptured(this);
            m_Dragged = false;
            TimelineCursors.ClearCursor();

            return(true);
        }