From 6eb90995773a61c74538c5e625ce0befafe5aefe Mon Sep 17 00:00:00 2001 From: lunarcleint <88809950+lunarcleint@users.noreply.github.com> Date: Tue, 19 Sep 2023 20:33:19 -0700 Subject: [PATCH] acuttaly cant belive this --- source/funkin/editors/charter/Charter.hx | 19 ++++++++++--------- source/funkin/editors/charter/CharterNote.hx | 4 ++-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index e969385f..12d7c23b 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -1212,16 +1212,17 @@ class Charter extends UIState { function changeNoteSustain(change:Float) { if (selection.length <= 0 || change == 0) return; - undos.addToUndo(CEditSustains([ - for(s in selection) { - if (s is CharterNote) { - var n:CharterNote = cast(s, CharterNote); - var old:Float = n.susLength; - n.updatePos(n.step, n.id, Math.max(n.susLength + change, 0)); - {before: old, after: n.susLength, note: n}; - } + var undoChanges:Array = []; + for(s in selection) { + if (s is CharterNote) { + var n:CharterNote = cast(s, CharterNote); + var old:Float = n.susLength; + n.updatePos(n.step, n.id, Math.max(n.susLength + change, 0)); + undoChanges.push({before: old, after: n.susLength, note: n}); } - ])); + } + + undos.addToUndo(CEditSustains(undoChanges)); } public function playtestChart(time:Float = 0, opponentMode = false, here = false) { diff --git a/source/funkin/editors/charter/CharterNote.hx b/source/funkin/editors/charter/CharterNote.hx index 0b2fd10e..5156ebdd 100644 --- a/source/funkin/editors/charter/CharterNote.hx +++ b/source/funkin/editors/charter/CharterNote.hx @@ -64,12 +64,12 @@ class CharterNote extends UISprite implements ICharterSelectable { public function get_fullID():Int return (strumLineID * 4) + id; - public function updatePos(step:Float, id:Int, susLength:Float = 0, ?type:Int = 0, ?strumLine:CharterStrumline) { + public function updatePos(step:Float, id:Int, susLength:Float = 0, ?type:Int = 0, ?strumLine:CharterStrumline = null) { this.step = step; this.id = id; this.susLength = susLength; this.type = type; - this.strumLine = strumLine; + if (strumLine != null) this.strumLine = strumLine; y = step * 40; sustainSpr.scale.set(10, (40 * susLength));