Skip to content

Commit 7c7dc11

Browse files
HundrecKade-github
authored andcommitted
Prevent the playhead from scrolling before song start
1 parent b883ad3 commit 7c7dc11

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

source/funkin/ui/debug/charting/ChartEditorState.hx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,10 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
355355
value = 0;
356356
}
357357

358+
// Make sure playhead doesn't scroll outside the song.
359+
if (value + playheadPositionInPixels < 0) playheadPositionInPixels = -value;
360+
if (value + playheadPositionInPixels > songLengthInPixels) playheadPositionInPixels = songLengthInPixels - value;
361+
358362
if (value > songLengthInPixels) value = songLengthInPixels;
359363

360364
if (value == scrollPositionInPixels) return value;

0 commit comments

Comments
 (0)