From d8bd6ce93b29ee014a2302e2cc2eead4ed2b93bb Mon Sep 17 00:00:00 2001 From: yugecin Date: Sun, 11 Dec 2016 19:48:01 +0100 Subject: [PATCH] add code again to remove sb options --- src/yugecin/opsudance/ui/SBOverlay.java | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/yugecin/opsudance/ui/SBOverlay.java b/src/yugecin/opsudance/ui/SBOverlay.java index fdfc168d..be723493 100644 --- a/src/yugecin/opsudance/ui/SBOverlay.java +++ b/src/yugecin/opsudance/ui/SBOverlay.java @@ -285,10 +285,26 @@ public class SBOverlay implements OptionsOverlay.Parent { } public boolean mouseReleased(int button, int x, int y) { - if (!menu) { + if (menu) { + overlay.mouseReleased(button, x, y); + return true; + } + if (x > 10 || index >= optionsMap.length || optionsMap[index] == null) { return false; } - overlay.mouseReleased(button, x, y); + int lh = Fonts.SMALL.getLineHeight(); + int ypos = 50 + lh / 4; + for (Object o : optionsMap[index].entrySet()) { + if (y >= ypos && y <= ypos + 10) { + optionsMap[index].remove(((Map.Entry) o).getKey()); + if (optionsMap[index].size() == 0) { + optionsMap[index] = null; + } + reloadSBsettingsToIndex(index); + return true; + } + ypos += lh; + } return true; }