コード例 #1
0
        protected override bool MouseDown(Event evt, WindowState state)
        {
            if (evt.button == 1)
            {
                ItemSelection.HandleSingleSelection(evt);
            }

            return(false);
        }
コード例 #2
0
ファイル: TrimClip.cs プロジェクト: Ryanco11/Stranger
        protected override bool MouseDown(Event evt, WindowState state)
        {
            var handle = PickerUtils.PickedLayerableOfType <TimelineClipHandle>();

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

            if (handle.clipGUI.clip.parentTrack != null && handle.clipGUI.clip.parentTrack.lockedInHierarchy)
            {
                return(false);
            }

            if (ItemSelection.CanClearSelection(evt))
            {
                SelectionManager.Clear();
            }

            if (!SelectionManager.Contains(handle.clipGUI.clip))
            {
                SelectionManager.Add(handle.clipGUI.clip);
            }

            m_TrimClipHandler = handle;

            m_IsCaptured = true;
            state.AddCaptured(this);

            m_UndoSaved = false;

            var clip = m_TrimClipHandler.clipGUI.clip;

            m_OriginalDuration        = clip.duration;
            m_OriginalTimeScale       = clip.timeScale;
            m_OriginalEaseInDuration  = clip.easeInDuration;
            m_OriginalEaseOutDuration = clip.easeOutDuration;

            RefreshOverlayStrings(m_TrimClipHandler, state);

            // in ripple trim, the right edge moves and needs to snap
            var edges = ManipulateEdges.Right;

            if (EditMode.editType != EditMode.EditType.Ripple && m_TrimClipHandler.trimDirection == TrimEdge.Start)
            {
                edges = ManipulateEdges.Left;
            }
            m_SnapEngine = new SnapEngine(m_TrimClipHandler.clipGUI, new TrimClipAttractionHandler(), edges, state,
                                          evt.mousePosition);

            EditMode.BeginTrim(ItemsUtils.ToItem(clip), m_TrimClipHandler.trimDirection);

            return(true);
        }
コード例 #3
0
        protected override bool MouseUp(Event evt, WindowState state)
        {
            if (!m_Dragged)
            {
                var item = PickerUtils.TopmostPickedItem() as ISelectable;

                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);
        }
コード例 #4
0
        protected override bool OnFinish(Event evt, WindowState state, Rect rect)
        {
            var selectables = state.spacePartitioner.GetItemsInArea <ISelectable>(rect).ToList();

            if (!selectables.Any())
            {
                return(false);
            }

            if (ItemSelection.CanClearSelection(evt))
            {
                SelectionManager.Clear();
            }

            foreach (var selectable in selectables)
            {
                ItemSelection.HandleItemSelection(evt, selectable);
            }

            return(true);
        }
コード例 #5
0
        protected override bool MouseDown(Event evt, WindowState state)
        {
            // If we hit this point this means no one used the mouse down events. We can safely clear the selection if needed
            if (evt.button != 0)
            {
                return(false);
            }

            var window = state.GetWindow();

            if (!window.sequenceRect.Contains(evt.mousePosition))
            {
                return(false);
            }

            if (ItemSelection.CanClearSelection(evt))
            {
                SelectionManager.Clear();
            }

            return(false);
        }
コード例 #6
0
 static bool HandleSingleSelection(Event evt)
 {
     return(ItemSelection.HandleSingleSelection(evt) != null);
 }