From b843beb3c0d14542db892c32e19401076dee07c9 Mon Sep 17 00:00:00 2001 From: fd Date: Sat, 19 Sep 2015 12:11:07 -0400 Subject: [PATCH] KineticScrolling Minor fixes for selection in large BeatmapSets --- src/itdelatrisu/opsu/states/SongMenu.java | 7 ++++--- src/itdelatrisu/opsu/ui/KineticScrolling.java | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/itdelatrisu/opsu/states/SongMenu.java b/src/itdelatrisu/opsu/states/SongMenu.java index 7523f793..74f359d8 100644 --- a/src/itdelatrisu/opsu/states/SongMenu.java +++ b/src/itdelatrisu/opsu/states/SongMenu.java @@ -1385,12 +1385,13 @@ public class SongMenu extends BasicGameState { updateDrawnSongPosition(); + // make sure focusNode is on the screen int val = focusNode.index + focusNode.beatmapIndex; - if (val <= startNode.index) + if (val * buttonOffset <= songScrolling.getPosition()) songScrolling.scrollToPosition(val * buttonOffset); - else if (val > startNode.index + MAX_SONG_BUTTONS - 1) - songScrolling.scrollToPosition((val - MAX_SONG_BUTTONS + 1) * buttonOffset); + else if (val* buttonOffset - (footerY - headerY - buttonOffset) >= songScrolling.getPosition()) + songScrolling.scrollToPosition(val * buttonOffset - (footerY - headerY - buttonOffset)); /* // Centers selected node diff --git a/src/itdelatrisu/opsu/ui/KineticScrolling.java b/src/itdelatrisu/opsu/ui/KineticScrolling.java index baaaaa35..78a1f111 100644 --- a/src/itdelatrisu/opsu/ui/KineticScrolling.java +++ b/src/itdelatrisu/opsu/ui/KineticScrolling.java @@ -103,6 +103,8 @@ public class KineticScrolling { * @param newPosition the position to scroll to */ public void scrollToPosition(float newPosition) { + pressed(); + released(); amplitude = newPosition - position; target = newPosition; totalDelta = 0;