This commit is contained in:
Lasercar 2025-04-04 16:04:06 -04:00 committed by GitHub
commit 9dda0964da
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,6 +1,9 @@
package funkin.ui.debug.charting.commands;
import funkin.data.song.SongData.SongTimeChange;
import funkin.data.song.SongDataUtils;
import funkin.data.song.SongData.SongEventData;
import funkin.data.song.SongData.SongNoteData;
/**
* A command which changes the starting BPM of the song.
@ -34,14 +37,15 @@ class ChangeStartingBPMCommand implements ChartEditorCommand
state.currentSongMetadata.timeChanges = timeChanges;
state.noteDisplayDirty = true;
state.notePreviewDirty = true;
state.notePreviewViewportBoundsDirty = true;
state.scrollPositionInPixels = 0;
Conductor.instance.mapTimeChanges(state.currentSongMetadata.timeChanges);
state.updateGridHeight();
// Fix the positions of the notes and events (don't ask me how this works, I have no clue). It just works!
// I considered putting this in updateGridHeight() but I've noticed it gets updated in a lot of places, so I won't.
state.currentSongChartNoteData = SongDataUtils.offsetSongNoteData(state.currentSongChartNoteData, 0);
state.currentSongChartEventData = SongDataUtils.offsetSongEventData(cstate.currentSongChartEventData, 0);
}
public function undo(state:ChartEditorState):Void
@ -58,14 +62,12 @@ class ChangeStartingBPMCommand implements ChartEditorCommand
state.currentSongMetadata.timeChanges = timeChanges;
state.noteDisplayDirty = true;
state.notePreviewDirty = true;
state.notePreviewViewportBoundsDirty = true;
state.scrollPositionInPixels = 0;
Conductor.instance.mapTimeChanges(state.currentSongMetadata.timeChanges);
state.updateGridHeight();
state.currentSongChartNoteData = SongDataUtils.offsetSongNoteData(state.currentSongChartNoteData, 0);
state.currentSongChartEventData = SongDataUtils.offsetSongEventData(cstate.currentSongChartEventData, 0);
}
public function shouldAddToHistory(state:ChartEditorState):Bool