From c2b64d7ec3553d72749c270dc497f54a1d206dd9 Mon Sep 17 00:00:00 2001 From: Yoshman29 <81191621+YoshiCrafter29@users.noreply.github.com> Date: Thu, 23 Mar 2023 12:34:31 +0100 Subject: [PATCH] GRAAAAAAAAAAAAAAH! selection box bs --- buildnumber.txt | 2 +- source/funkin/editors/charter/Charter.hx | 32 +++++++++++++++++------- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/buildnumber.txt b/buildnumber.txt index 196a78e0..e39b4bbb 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -2670 \ No newline at end of file +2673 \ No newline at end of file diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index 074fd7d3..206107eb 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -250,6 +250,8 @@ class Charter extends UIState { if (FlxG.mouse.justReleased) { if (FlxG.keys.pressed.CONTROL) selection.push(n); + else if (FlxG.keys.pressed.SHIFT) + selection.remove(n); else selection = [n]; } @@ -282,16 +284,28 @@ class Charter extends UIState { } if (FlxG.mouse.justReleased) { if (selectionBoxEnabled) { - var minX = Std.int(Math.round(selectionBox.x / 40)); - var minY = Math.round(selectionBox.y / 40) - 1; - var maxX = Std.int(Math.round((selectionBox.x + selectionBox.bWidth) / 40)); - var maxY = Math.round((selectionBox.y + selectionBox.bHeight) / 40); + var minX = Std.int(selectionBox.x / 40); + var minY = Std.int(selectionBox.y / 40); + var maxX = Std.int(Math.ceil((selectionBox.x + selectionBox.bWidth) / 40)); + var maxY = Math.ceil((selectionBox.y + selectionBox.bHeight) / 40); - selection = []; - notesGroup.forEach(function(n) { - if (n.id >= minX && n.id <= maxX && n.step >= minY && n.step <= maxY) - selection.push(n); - }); + if (FlxG.keys.pressed.SHIFT) { + notesGroup.forEach(function(n) { + if (n.id >= minX && n.id < maxX && n.step >= minY && n.step < maxY && selection.contains(n)) + selection.remove(n); + }); + } else if (FlxG.keys.pressed.CONTROL) { + notesGroup.forEach(function(n) { + if (n.id >= minX && n.id < maxX && n.step >= minY && n.step < maxY && !selection.contains(n)) + selection.push(n); + }); + } else { + selection = []; + notesGroup.forEach(function(n) { + if (n.id >= minX && n.id < maxX && n.step >= minY && n.step < maxY) + selection.push(n); + }); + } selectionBoxEnabled = false; } else {