From d66141c15afecaa85703973297dbaae4f1e65e14 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Wed, 22 Nov 2023 19:53:56 -0500 Subject: [PATCH] playhead dragging --- .../ui/debug/charting/ChartEditorState.hx | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx index 4772fab7c..84883b591 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -1956,16 +1956,21 @@ class ChartEditorState extends HaxeUIState } } + playbarHead.onDrag = function(_:DragEvent) { + if (playbarHeadDragging) + { + var value:Null = playbarHead?.value; + + // Set the song position to where the playhead was moved to. + scrollPositionInPixels = songLengthInPixels * ((value ?? 0.0) / 100); + // Update the conductor and audio tracks to match. + moveSongToScrollPosition(); + } + } + playbarHead.onDragEnd = function(_:DragEvent) { playbarHeadDragging = false; - var value:Null = playbarHead?.value; - - // Set the song position to where the playhead was moved to. - scrollPositionInPixels = songLengthInPixels * ((value ?? 0.0) / 100); - // Update the conductor and audio tracks to match. - moveSongToScrollPosition(); - // If we were dragging the playhead while the song was playing, resume playing. if (playbarHeadDraggingWasPlaying) {