From ed3cf4765568ef8dd88ab3b4d6941d465dfb770b Mon Sep 17 00:00:00 2001 From: Frakits Date: Thu, 15 Feb 2024 17:46:42 +0200 Subject: [PATCH] better sustain drag i guess --- source/funkin/editors/charter/Charter.hx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index 27e82774..d23473ef 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -768,9 +768,19 @@ class Charter extends UIState { } if (FlxG.mouse.pressedRight) { - if (mousePos.y - dragStartPos.y > 20) + if (Math.abs(mousePos.y - dragStartPos.y) > 20) showContextMenu = true; - if (showContextMenu) changeNoteSustain(FlxG.mouse.deltaScreenY / 40); + if (showContextMenu) { + var undoChanges:Array = []; + for(s in selection) + if (s is CharterNote) { + var n:CharterNote = cast s; + var old:Float = n.susLength; + n.updatePos(n.step, n.id, Math.max((mousePos.y - dragStartPos.y) / 40, 0)); + undoChanges.push({before: old, after: n.susLength, note: n}); + } + undos.addToUndo(CEditSustains(undoChanges)); + } } if (FlxG.mouse.justReleasedRight) { if (!showContextMenu) {