From 2d65f6f6d226ed7348d451ff260f915c32e54916 Mon Sep 17 00:00:00 2001 From: lunarcleint <88809950+lunarcleint@users.noreply.github.com> Date: Fri, 28 Jul 2023 19:08:48 -0700 Subject: [PATCH] fix some bugs events --- source/funkin/editors/charter/Charter.hx | 28 +++++++++++++------ source/funkin/editors/charter/CharterEvent.hx | 4 +-- .../editors/charter/CharterEventScreen.hx | 2 +- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index 43e020ad..878191e3 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -622,7 +622,7 @@ class Charter extends UIState { } } - if (gridActionType == NONE && mousePos.x < 0) { + if (gridActionType == NONE && mousePos.x < 0 && mousePos.x > -addEventSpr.bWidth) { addEventSpr.incorporeal = false; addEventSpr.sprAlpha = lerp(addEventSpr.sprAlpha, 0.75, 0.25); var event = getHoveredEvent(mousePos.y); @@ -678,9 +678,15 @@ class Charter extends UIState { eventsGroup.add(e); e.revive(); e.refreshEventIcons(); - }); + }, false); sortNotes(); + for (s in selection) + if (s is CharterEvent) { + Charter.instance.updateBPMEvents(); + break; + } + if (addToUndo) this.addToUndo(CCreateSelection(selection)); return []; @@ -701,6 +707,12 @@ class Charter extends UIState { } sortNotes(); + for (s in selection) + if (s is CharterEvent) { + Charter.instance.updateBPMEvents(); + break; + } + if (addToUndo) this.addToUndo(CDeleteSelection(selection)); return []; @@ -1055,7 +1067,7 @@ class Charter extends UIState { event.events = oldEvents.copy(); event.refreshEventIcons(); - Charter.instance.updateBPMEvents(event); + Charter.instance.updateBPMEvents(); } if (v != null) redoList.insert(0, v); @@ -1096,7 +1108,7 @@ class Charter extends UIState { event.events = newEvents.copy(); event.refreshEventIcons(); - Charter.instance.updateBPMEvents(event); + Charter.instance.updateBPMEvents(); } if (v != null) undoList.insert(0, v); @@ -1242,7 +1254,7 @@ class Charter extends UIState { } } - public function updateBPMEvents(newEvent:CharterEvent) { + public function updateBPMEvents() { buildEvents(); Conductor.mapBPMChanges(PlayState.SONG); @@ -1281,11 +1293,11 @@ typedef NoteSustainChange = { this = array == null ? [] : array; // too lazy to put this in every for loop so i made it a abstract - public inline function loop(onNote:CharterNote->Void, ?onEvent:CharterEvent->Void) { + public inline function loop(onNote:CharterNote->Void, ?onEvent:CharterEvent->Void, ?draggableOnly:Bool = true) { for (s in this) { - if (s is CharterNote && onNote != null && s.draggable) + if (s is CharterNote && onNote != null && (draggableOnly ? s.draggable: true)) onNote(cast(s, CharterNote)); - else if (s is CharterEvent && onEvent != null && s.draggable) + else if (s is CharterEvent && onEvent != null && (draggableOnly ? s.draggable: true)) onEvent(cast(s, CharterEvent)); } } diff --git a/source/funkin/editors/charter/CharterEvent.hx b/source/funkin/editors/charter/CharterEvent.hx index 21723627..aa593a50 100644 --- a/source/funkin/editors/charter/CharterEvent.hx +++ b/source/funkin/editors/charter/CharterEvent.hx @@ -77,10 +77,8 @@ class CharterEvent extends UISliceSprite implements ICharterSelectable { return (selectionBox.x + selectionBox.bWidth > x) && (selectionBox.x < x + bWidth) && (selectionBox.y + selectionBox.bHeight > y) && (selectionBox.y < y + bHeight); } - public function handleDrag(change:FlxPoint) { + public function handleDrag(change:FlxPoint) y = ((step += change.x) * 40) - 17; - Charter.instance.updateBPMEvents(this); - } public function refreshEventIcons() { while(icons.length > 0) { diff --git a/source/funkin/editors/charter/CharterEventScreen.hx b/source/funkin/editors/charter/CharterEventScreen.hx index 7f84347d..fa2e63a9 100644 --- a/source/funkin/editors/charter/CharterEventScreen.hx +++ b/source/funkin/editors/charter/CharterEventScreen.hx @@ -96,7 +96,7 @@ class CharterEventScreen extends UISubstateWindow { } close(); - Charter.instance.updateBPMEvents(chartEvent); + Charter.instance.updateBPMEvents(); }); saveButton.x -= saveButton.bWidth; saveButton.y -= saveButton.bHeight;