1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-01-27 07:17:20 +00:00

Merge pull request #292 from FunkinCrew/bugfix/chart-editor-selection-box

Fix a bug where the drag-to-select box in the chart editor is not visible
This commit is contained in:
Cameron Taylor 2024-01-18 00:40:05 -05:00 committed by GitHub
commit ab9b6d6c47
2 changed files with 19 additions and 12 deletions

View file

@ -2000,7 +2000,6 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
buildGrid();
buildMeasureTicks();
buildNotePreview();
buildSelectionBox();
buildAdditionalUI();
populateOpenRecentMenu();
@ -2329,17 +2328,6 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
setNotePreviewViewportBounds(calculateNotePreviewViewportBounds());
}
function buildSelectionBox():Void
{
if (selectionBoxSprite == null) throw 'ERROR: Tried to build selection box, but selectionBoxSprite is null! Check ChartEditorThemeHandler.updateTheme().';
selectionBoxSprite.scrollFactor.set(0, 0);
add(selectionBoxSprite);
selectionBoxSprite.zIndex = 30;
setSelectionBoxBounds();
}
function setSelectionBoxBounds(bounds:FlxRect = null):Void
{
if (selectionBoxSprite == null)
@ -2361,6 +2349,19 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
}
}
/**
* Automatically goes through and calls render on everything you added.
*/
override public function draw():Void
{
if (selectionBoxStartPos != null)
{
trace('selectionBoxSprite: ${selectionBoxSprite.visible} ${selectionBoxSprite.exists} ${this.members.contains(selectionBoxSprite)}');
}
super.draw();
}
function calculateNotePreviewViewportBounds():FlxRect
{
var bounds:FlxRect = new FlxRect();

View file

@ -317,6 +317,12 @@ class ChartEditorThemeHandler
ChartEditorState.GRID_SIZE
- (2 * SELECTION_SQUARE_BORDER_WIDTH + 8)),
32, 32);
state.selectionBoxSprite.scrollFactor.set(0, 0);
state.selectionBoxSprite.zIndex = 30;
state.add(state.selectionBoxSprite);
state.setSelectionBoxBounds();
}
static function updateNotePreview(state:ChartEditorState):Void