mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-11-29 02:04:28 +00:00
Fix issue where playbar scroll area wasn't scaled to the grid.
This commit is contained in:
parent
bb09cc19e7
commit
c24fa3c154
|
@ -1282,9 +1282,13 @@ class ChartEditorState extends HaxeUIState
|
|||
|
||||
buildNoteGroup();
|
||||
|
||||
gridPlayheadScrollArea = new FlxSprite(gridTiledSprite.x - PLAYHEAD_SCROLL_AREA_WIDTH,
|
||||
MENU_BAR_HEIGHT).makeGraphic(PLAYHEAD_SCROLL_AREA_WIDTH, FlxG.height - MENU_BAR_HEIGHT, PLAYHEAD_SCROLL_AREA_COLOR);
|
||||
gridPlayheadScrollArea = new FlxSprite(0, 0);
|
||||
gridPlayheadScrollArea.makeGraphic(10, 10, PLAYHEAD_SCROLL_AREA_COLOR); // Make it 10x10px and then scale it as needed.
|
||||
add(gridPlayheadScrollArea);
|
||||
gridPlayheadScrollArea.setGraphicSize(PLAYHEAD_SCROLL_AREA_WIDTH, 3000);
|
||||
gridPlayheadScrollArea.updateHitbox();
|
||||
gridPlayheadScrollArea.x = gridTiledSprite.x - PLAYHEAD_SCROLL_AREA_WIDTH;
|
||||
gridPlayheadScrollArea.y = MENU_BAR_HEIGHT + GRID_TOP_PAD;
|
||||
gridPlayheadScrollArea.zIndex = 25;
|
||||
|
||||
// The playhead that show the current position in the song.
|
||||
|
@ -3685,25 +3689,29 @@ class ChartEditorState extends HaxeUIState
|
|||
this.scrollPositionInPixels = value;
|
||||
|
||||
// Move the grid sprite to the correct position.
|
||||
if (gridTiledSprite != null)
|
||||
{
|
||||
if (isViewDownscroll)
|
||||
{
|
||||
if (gridTiledSprite != null) gridTiledSprite.y = -scrollPositionInPixels + (MENU_BAR_HEIGHT + GRID_TOP_PAD);
|
||||
gridTiledSprite.y = -scrollPositionInPixels + (MENU_BAR_HEIGHT + GRID_TOP_PAD);
|
||||
gridPlayheadScrollArea.y = gridTiledSprite.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gridTiledSprite != null) gridTiledSprite.y = -scrollPositionInPixels + (MENU_BAR_HEIGHT + GRID_TOP_PAD);
|
||||
gridTiledSprite.y = -scrollPositionInPixels + (MENU_BAR_HEIGHT + GRID_TOP_PAD);
|
||||
gridPlayheadScrollArea.y = gridTiledSprite.y;
|
||||
}
|
||||
}
|
||||
|
||||
// Move the rendered notes to the correct position.
|
||||
renderedNotes.setPosition(gridTiledSprite?.x ?? 0.0, gridTiledSprite?.y ?? 0.0);
|
||||
renderedHoldNotes.setPosition(gridTiledSprite?.x ?? 0.0, gridTiledSprite?.y ?? 0.0);
|
||||
renderedEvents.setPosition(gridTiledSprite?.x ?? 0.0, gridTiledSprite?.y ?? 0.0);
|
||||
renderedSelectionSquares.setPosition(gridTiledSprite?.x ?? 0.0, gridTiledSprite?.y ?? 0.0);
|
||||
|
||||
// Offset the selection box start position, if we are dragging.
|
||||
if (selectionBoxStartPos != null) selectionBoxStartPos.y -= diff;
|
||||
// Update the note preview viewport box.
|
||||
setNotePreviewViewportBounds(calculateNotePreviewViewportBounds());
|
||||
|
||||
return this.scrollPositionInPixels;
|
||||
}
|
||||
|
||||
|
@ -3862,6 +3870,11 @@ class ChartEditorState extends HaxeUIState
|
|||
songLengthInMs = audioInstTrack.length;
|
||||
|
||||
if (gridTiledSprite != null) gridTiledSprite.height = songLengthInPixels;
|
||||
if (gridPlayheadScrollArea != null)
|
||||
{
|
||||
gridPlayheadScrollArea.setGraphicSize(Std.int(gridPlayheadScrollArea.width), songLengthInPixels);
|
||||
gridPlayheadScrollArea.updateHitbox();
|
||||
}
|
||||
|
||||
buildSpectrogram(audioInstTrack);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue