Ejemplo n.º 1
0
        public void AddNoteSelection(S2VXNote note)
        {
            NotesTimeline.AddNoteTimelineSelection(note);
            var noteSelection = new RelativeBox {
                Colour   = Color4.LimeGreen.Opacity(0.5f),
                Width    = note.Size.X + SelectionIndicatorThickness,
                Height   = note.Size.Y + SelectionIndicatorThickness,
                Rotation = note.Rotation,
            };

            noteSelection.X = note.Position.X;
            noteSelection.Y = note.Position.Y;
            Editor.NoteSelectionIndicators.Add(noteSelection);
            NoteSelectionToNote[noteSelection] = note;
        }
Ejemplo n.º 2
0
        private Direction GetTimelineScrollDirection(DragEvent e)
        {
            var result      = Direction.None;
            var mousePos    = e.ScreenSpaceMousePosition;
            var nearestTick = NotesTimeline.GetNearestTick(GetGameTimeAtMouse(mousePos));

            if (nearestTick <= NotesTimeline.FirstVisibleTick && MouseDragDirection(e) == Direction.Left)
            {
                result = Direction.Left;
            }
            else if (nearestTick >= NotesTimeline.LastVisibleTick && MouseDragDirection(e) == Direction.Right)
            {
                result = Direction.Right;
            }
            return(result);
        }
Ejemplo n.º 3
0
        public override void OnToolDrag(DragEvent e)
        {
            if (!DelayDrag)
            {
                switch (ToDrag)
                {
                case SelectToolDragState.DragHoldNoteEndTime: {
                    var gameTimeAtMouse = GetGameTimeAtMouse(e.ScreenSpaceMousePosition);
                    var oldDuration     = OldEndTime - OldHitTime;
                    switch (GetTimelineScrollDirection(e))
                    {
                    case Direction.Left:
                        // When modifying the end time of a HoldNote we should not scroll left from where we started
                        if (NotesTimeline.FirstVisibleTick > OldFirstVisibleTick)
                        {
                            NotesTimeline.SnapToTick(true);
                        }
                        break;

                    case Direction.Right:
                        NotesTimeline.SnapToTick(false);
                        break;
                    }
                    foreach (var note in NotesTimeline.SelectedNoteToTime.Keys.ToList())
                    {
                        var newTime = GetClosestTickTime(gameTimeAtMouse - TimelineNoteToDragPointDelta[note]);
                        note.UpdateEndTime(newTime + oldDuration);
                        NotesTimeline.AddNoteTimelineSelection(note);
                    }
                    break;
                }

                case SelectToolDragState.DragTimelineNote: {
                    var gameTimeAtMouse = GetGameTimeAtMouse(e.ScreenSpaceMousePosition);
                    switch (GetTimelineScrollDirection(e))
                    {
                    case Direction.Left:
                        NotesTimeline.SnapToTick(true);
                        break;

                    case Direction.Right:
                        NotesTimeline.SnapToTick(false);
                        break;
                    }
                    foreach (var note in NotesTimeline.SelectedNoteToTime.Keys.ToList())
                    {
                        var newTime = GetClosestTickTime(gameTimeAtMouse - TimelineNoteToDragPointDelta[note]);
                        note.UpdateHitTime(newTime);
                        NotesTimeline.AddNoteTimelineSelection(note);
                    }
                    break;
                }

                case SelectToolDragState.DragNote: {
                    var mousePos = Editor.MousePosition;

                    foreach (var noteAndTime in NotesTimeline.SelectedNoteToTime)
                    {
                        var note   = noteAndTime.Key;
                        var newPos = mousePos + NoteToDragPointDelta[note];
                        note.UpdateCoordinates(newPos);
                    }
                    break;
                }

                case SelectToolDragState.None:
                    break;
                }
                DelayDrag = true;
            }
        }
Ejemplo n.º 4
0
 public void ClearNoteSelection()
 {
     NotesTimeline.ClearNoteTimelineSelection();
     Editor.NoteSelectionIndicators.Clear();
     NoteSelectionToNote.Clear();
 }