From f3e8833cf3039f07644578e20558a68aaf0e15bd Mon Sep 17 00:00:00 2001 From: lunarcleint <88809950+lunarcleint@users.noreply.github.com> Date: Sun, 7 Jan 2024 13:57:03 -0700 Subject: [PATCH] fix add event following mouse --- source/funkin/editors/charter/Charter.hx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index 8cfad2f1..c1c468b2 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -746,7 +746,7 @@ class Charter extends UIState { addEventSpr.sprAlpha = lerp(addEventSpr.sprAlpha, 0.75, 0.25); var event = getHoveredEvent(mousePos.y); if (event != null) addEventSpr.updateEdit(event); - else addEventSpr.updatePos(FlxG.keys.pressed.SHIFT ? ((mousePos.y+20) / 40) : quantStep(mousePos.y/40)); + else addEventSpr.updatePos(FlxG.keys.pressed.SHIFT ? ((mousePos.y) / 40) : quantStepRounded(mousePos.y/40)); } else addEventSpr.sprAlpha = lerp(addEventSpr.sprAlpha, 0, 0.25); // Note Hoverer @@ -772,6 +772,11 @@ class Charter extends UIState { return Math.floor(step/stepMulti) * stepMulti; } + public function quantStepRounded(step:Float):Float { + var stepMulti:Float = 1/(quant/16); + return Math.round(step/stepMulti) * stepMulti; + } + public function getHoveredEvent(y:Float) { var eventHovered:CharterEvent = null; eventsGroup.forEach(function(e) {