mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-22 03:52:18 +00:00
GuiSoundSelection 1.12
Backports GuiSoundSelection from 1.12 - customScrollDoubleClicked (to be renamed) - Better GUI Selection Handling
This commit is contained in:
1 parent
0f343b66a9
commit
3dc60ec1a7
7 files changed
+785
-21
No files matched your search
@@ -36,6 +36,9 @@ public class GuiCustomScroll extends GuiScreen
|
||||
public boolean visible = true;
|
||||
private boolean selectable = true;
|
||||
|
||||
private int lastClickedItem;
|
||||
private long lastClickedTime = 0;
|
||||
|
||||
public GuiCustomScroll(GuiScreen parent, int id)
|
||||
{
|
||||
width = 176;
|
||||
@@ -274,8 +277,16 @@ public class GuiCustomScroll extends GuiScreen
|
||||
selected = hover;
|
||||
hover = -1;
|
||||
}
|
||||
if(listener != null)
|
||||
listener.customScrollClicked(i, j, k,this);
|
||||
|
||||
if(listener != null) {
|
||||
long time = System.currentTimeMillis();
|
||||
listener.customScrollClicked(i, j, k, this);
|
||||
if(selected >= 0 && selected == lastClickedItem && time - lastClickedTime < 500) {
|
||||
listener.customScrollDoubleClicked(list.get(selected), this);
|
||||
}
|
||||
lastClickedTime = time;
|
||||
lastClickedItem = selected;
|
||||
}
|
||||
}
|
||||
|
||||
private void drawScrollBar()
|
||||
|
||||
Reference in new issue
Block a user