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; }
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); }
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; } }
public void ClearNoteSelection() { NotesTimeline.ClearNoteTimelineSelection(); Editor.NoteSelectionIndicators.Clear(); NoteSelectionToNote.Clear(); }