From de7d599cdd00d9f9b5d4d80a50731504a5ac8153 Mon Sep 17 00:00:00 2001 From: lunarcleint <88809950+lunarcleint@users.noreply.github.com> Date: Thu, 29 Feb 2024 18:44:35 -0700 Subject: [PATCH] qaunt sus dragging (WIP) --- source/funkin/editors/charter/Charter.hx | 3 +++ source/funkin/editors/charter/CharterNote.hx | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index a5a800ce..11bf74eb 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -768,6 +768,8 @@ class Charter extends UIState { currentCursor = BUTTON; selection.loop(function (n:CharterNote) { n.tempSusLength = Math.max((mousePos.y-dragStartPos.y) / 40, -n.susLength); + if (!FlxG.keys.pressed.SHIFT) n.tempSusLength = quantStep(n.tempSusLength); + @:privateAccess n.__susInstaLerp = true; }); } else { var undoChanges:Array = []; @@ -777,6 +779,7 @@ class Charter extends UIState { n.susLength += n.tempSusLength; n.tempSusLength = 0; + @:privateAccess n.__susInstaLerp = false; n.updatePos(n.step, n.id, n.susLength, n.type); undoChanges.push({before: oldSusLen, after: n.susLength, note: n}); }); diff --git a/source/funkin/editors/charter/CharterNote.hx b/source/funkin/editors/charter/CharterNote.hx index 588a1584..bfde49c3 100644 --- a/source/funkin/editors/charter/CharterNote.hx +++ b/source/funkin/editors/charter/CharterNote.hx @@ -11,6 +11,7 @@ class CharterNote extends UISprite implements ICharterSelectable { var angleTween:FlxTween; var __doAnim:Bool = false; var __animSpeed:Float = 1; + var __susInstaLerp:Bool = false; private static var colors:Array = [ 0xFFC24B99, @@ -150,7 +151,8 @@ class CharterNote extends UISprite implements ICharterSelectable { sustainDraggable = UIState.state.isOverlapping(sustainHitbox, @:privateAccess sustainHitbox.__rect); } - sustainSpr.scale.set(10, CoolUtil.fpsLerp(sustainSpr.scale.y, (40 * (susLength+tempSusLength)) + ((susLength+tempSusLength) != 0 ? (height/2) : 0), 1/2)); + var sprLength:Float = (40 * (susLength+tempSusLength)) + ((susLength+tempSusLength) != 0 ? (height/2) : 0); + sustainSpr.scale.set(10, __susInstaLerp ? sprLength : CoolUtil.fpsLerp(sustainSpr.scale.y, sprLength, 1/2)); sustainSpr.updateHitbox(); sustainSpr.follow(this, 15, 20);