1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-25 08:13:45 +00:00

Additional cursor and playbar fixes.

This commit is contained in:
EliteMasterEric 2023-09-12 19:40:58 -04:00
parent fa28932dea
commit 7083f6e7ce
2 changed files with 13 additions and 17 deletions

View file

@ -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;
}

View file

@ -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)
{