From ec7a230782b0bbaabc96ee7c5bc67bbf14218077 Mon Sep 17 00:00:00 2001 From: tillvit Date: Sat, 30 Dec 2023 10:46:10 -0800 Subject: [PATCH] Select region with timing events --- app/src/chart/ChartManager.ts | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/app/src/chart/ChartManager.ts b/app/src/chart/ChartManager.ts index 5b67f620..c623cc8d 100644 --- a/app/src/chart/ChartManager.ts +++ b/app/src/chart/ChartManager.ts @@ -50,7 +50,7 @@ import { isHoldNote, } from "./sm/NoteTypes" import { Simfile } from "./sm/Simfile" -import { Cached, TimingEvent } from "./sm/TimingTypes" +import { Cached, TIMING_EVENT_NAMES, TimingEvent } from "./sm/TimingTypes" const SNAPS = [1, 2, 3, 4, 6, 8, 12, 16, 24, 48, -1] @@ -1762,13 +1762,25 @@ export class ChartManager { this.endRegion = this.startRegion this.startRegion = this.beat } - this.loadedChart - .getNotedata() - .filter( - note => note.beat >= this.startRegion! && note.beat <= this.endRegion! + if (this.editTimingMode == EditTimingMode.Off) { + this.setNoteSelection( + this.loadedChart + .getNotedata() + .filter( + note => + note.beat >= this.startRegion! && note.beat <= this.endRegion! + ) + .filter(note => !this.selection.notes.includes(note)) ) - .filter(note => !this.selection.notes.includes(note)) - .forEach(note => this.addNoteToSelection(note)) + } else { + this.setEventSelection( + TIMING_EVENT_NAMES.flatMap( + event => + this.loadedChart!.timingData.getColumn(event) + .events as Cached[] + ) + ) + } } modifySelection(modify: (note: NotedataEntry) => PartialNotedataEntry) {