コード例 #1
0
ファイル: SelectToolState.cs プロジェクト: maxrchung/S2VX
        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;
        }
コード例 #2
0
ファイル: SelectToolState.cs プロジェクト: maxrchung/S2VX
        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;
            }
        }