From f446c638c544d3dbcbd02f361da215a13fa38800 Mon Sep 17 00:00:00 2001 From: lunarcleint <88809950+lunarcleint@users.noreply.github.com> Date: Sat, 3 Feb 2024 22:09:56 -0700 Subject: [PATCH] QAUNTIZED DRAGGING + some animation changes :D --- .../images/editors/charter/strumline-drag.png | Bin 129 -> 151 bytes source/funkin/editors/charter/Charter.hx | 16 ++++++++-------- .../editors/charter/CharterStrumlineButton.hx | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/assets/images/editors/charter/strumline-drag.png b/assets/images/editors/charter/strumline-drag.png index 9fb8fa5ef1208549c02d90da164a002241fadafc..e886483ff98ee2343b8e5dfb0f2deeffe43f4884 100644 GIT binary patch delta 109 zcmV-z0FwWK0ha-gF=kOoL_t(YiS5)o4geqs1JKs{-x&w|#SIrrLKBzQi39<5Y`iZ=#WBRAGdV#*?}5Dtk7=RX424ZfZf?gEmCv=jJFLjf<~>Ovyhen_ qLL$dAX^V(dQNjil&Z493It&bgNA1NdAJ3Cx00K`}KbLh*2~7alc^j+% diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index e2dd272b..7451bbe2 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -635,16 +635,16 @@ class Charter extends UIState { break; } - dragStartPos.set(Std.int(dragStartPos.x / 40) * 40, quantStep(dragStartPos.y/40)*40); //credits to burgerballs - var verticalChange:Float = - FlxG.keys.pressed.SHIFT ? ((mousePos.y - hoverOffset.y) - dragStartPos.y) / 40 - : CoolUtil.floorInt(quantStep((mousePos.y - dragStartPos.y) / 40)); + dragStartPos.set(Std.int(dragStartPos.x / 40) * 40, dragStartPos.y); //credits to burgerballs + var verticalChange:Float = ((mousePos.y - hoverOffset.y) - dragStartPos.y) / 40; var horizontalChange:Int = CoolUtil.floorInt((mousePos.x - dragStartPos.x) / 40); - var changePoint:FlxPoint = FlxPoint.get(verticalChange, horizontalChange); var undoDrags:Array = []; for (s in selection) { + trace(s.step, verticalChange, s.step + verticalChange, quantStep(s.step+verticalChange)); + trace(verticalChange - ((s.step + verticalChange) - quantStep(s.step+verticalChange))); if (s.draggable) { + var changePoint:FlxPoint = FlxPoint.get(verticalChange - ((s.step + verticalChange) - quantStep(s.step+verticalChange)), horizontalChange); var boundedChange:FlxPoint = changePoint.clone(); // Some maths, so cool bro -lunar (i dont know why i quopte my self here) @@ -657,16 +657,16 @@ class Charter extends UIState { if (note.fullID + changePoint.y > (strumLines.members.length*4)-1) boundedChange.y -= (note.fullID + changePoint.y) - ((strumLines.members.length*4)-1); } - s.handleDrag(changePoint); + s.handleDrag(boundedChange); undoDrags.push({selectable:s, change: boundedChange}); + changePoint.put(); } if (s is CharterNote) cast(s, CharterNote).snappedToStrumline = true; if (s is UISprite) cast(s, UISprite).cursor = BUTTON; } - if (!(changePoint.x == 0 && changePoint.y == 0)) undos.addToUndo(CSelectionDrag(undoDrags)); + if (!(verticalChange == 0 && horizontalChange == 0)) undos.addToUndo(CSelectionDrag(undoDrags)); - changePoint.put(); hoverOffset.put(); gridActionType = NONE; diff --git a/source/funkin/editors/charter/CharterStrumlineButton.hx b/source/funkin/editors/charter/CharterStrumlineButton.hx index f43db989..2a6fd184 100644 --- a/source/funkin/editors/charter/CharterStrumlineButton.hx +++ b/source/funkin/editors/charter/CharterStrumlineButton.hx @@ -23,7 +23,7 @@ class CharterStrumlineButton extends UISprite { button.animation.play("0", true); button.scale.set(0.85,0.85); button.updateHitbox(); - button.antialiasing = false; + button.antialiasing = true; button.cursor = BUTTON; members.push(button); @@ -93,7 +93,7 @@ class CharterStrumlineButton extends UISprite { .then(FlxTween.tween(this, {buttonYOffset: 0}, .1 + FlxG.random.float(.1, .3), {ease: FlxEase.circIn})); if (scaleTween != null) scaleTween.cancel(); buttonScaleOffset.set(0,0); - scaleTween = FlxTween.tween(buttonScaleOffset, {x: .015, y: .02}, .12, {ease: FlxEase.circOut}) + scaleTween = FlxTween.tween(buttonScaleOffset, {x: .015 * (extra ? 3 : 1), y: .02 * (extra ? 3 : 1)}, .12, {ease: FlxEase.circOut}) .then(FlxTween.tween(buttonScaleOffset, {x: 0, y: 0}, .1 + FlxG.random.float(.1, .3), {ease: FlxEase.circIn})); if (!extra) return;