From 7083f6e7ce40160936bd12fc2d2a5f5c5918c870 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Tue, 12 Sep 2023 19:40:58 -0400 Subject: [PATCH] Additional cursor and playbar fixes. --- .../ui/debug/charting/ChartEditorState.hx | 20 +++++++++++-------- .../ui/haxeui/components/FunkinMenuBar.hx | 10 +--------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx index 7f6e2b679..a68067f16 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -1877,13 +1877,15 @@ class ChartEditorState extends HaxeUIState if (pageUpKeyHandler.activated) { var measureHeight:Float = GRID_SIZE * 4 * Conductor.beatsPerMeasure; - var targetScrollPosition:Float = Math.floor(scrollPositionInPixels / measureHeight) * measureHeight; + var playheadPos:Float = scrollPositionInPixels + playheadPositionInPixels; + var targetScrollPosition:Float = Math.floor(playheadPos / measureHeight) * measureHeight; // If we would move less than one grid, instead move to the top of the previous measure. - if (Math.abs(targetScrollPosition - scrollPositionInPixels) < GRID_SIZE) + var targetScrollAmount = Math.abs(targetScrollPosition - playheadPos); + if (targetScrollAmount < GRID_SIZE) { - targetScrollPosition -= GRID_SIZE * 4 * Conductor.beatsPerMeasure; + targetScrollPosition -= GRID_SIZE * Constants.STEPS_PER_BEAT * Conductor.beatsPerMeasure; } - scrollAmount = targetScrollPosition - scrollPositionInPixels; + scrollAmount = targetScrollPosition - playheadPos; shouldPause = true; } @@ -1898,13 +1900,15 @@ class ChartEditorState extends HaxeUIState if (pageDownKeyHandler.activated) { var measureHeight:Float = GRID_SIZE * 4 * Conductor.beatsPerMeasure; - var targetScrollPosition:Float = Math.ceil(scrollPositionInPixels / measureHeight) * measureHeight; + var playheadPos:Float = scrollPositionInPixels + playheadPositionInPixels; + var targetScrollPosition:Float = Math.ceil(playheadPos / measureHeight) * measureHeight; // If we would move less than one grid, instead move to the top of the next measure. - if (Math.abs(targetScrollPosition - scrollPositionInPixels) < GRID_SIZE) + var targetScrollAmount = Math.abs(targetScrollPosition - playheadPos); + if (targetScrollAmount < GRID_SIZE) { - targetScrollPosition += GRID_SIZE * 4 * Conductor.beatsPerMeasure; + targetScrollPosition += GRID_SIZE * Constants.STEPS_PER_BEAT * Conductor.beatsPerMeasure; } - scrollAmount = targetScrollPosition - scrollPositionInPixels; + scrollAmount = targetScrollPosition - playheadPos; shouldPause = true; } diff --git a/source/funkin/ui/haxeui/components/FunkinMenuBar.hx b/source/funkin/ui/haxeui/components/FunkinMenuBar.hx index 1dcfb770c..393372d74 100644 --- a/source/funkin/ui/haxeui/components/FunkinMenuBar.hx +++ b/source/funkin/ui/haxeui/components/FunkinMenuBar.hx @@ -18,15 +18,7 @@ class FunkinMenuBar extends MenuBar registerListeners(); } - private function registerListeners():Void - { - var builder = cast(this._compositeBuilder, MenuBar.Builder); - for (button in builder._buttons) - { - button.onMouseOver = handleMouseOver; - button.onMouseOut = handleMouseOut; - } - } + private function registerListeners():Void {} private function handleMouseOver(event:MouseEvent) {