From 2bcde66ce1c01ea6da785e422c46c6f178ca10c2 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 24 Mar 2023 22:36:45 +0100 Subject: Code cleanup --- .../config/core/config/gui/GuiPositionEditor.kt | 36 ++++++++++++++-------- 1 file changed, 24 insertions(+), 12 deletions(-) (limited to 'src/main/java/at/hannibal2') diff --git a/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt b/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt index 4e608ee3b..44672ff46 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt @@ -101,20 +101,32 @@ class GuiPositionEditor( val elementHeight = position.getDummySize().y drawRect(x - border, y - border, x + elementWidth + border * 2, y + elementHeight + border * 2, -0x7fbfbfc0) - if (hoveredPos != -1) { - val pos = positions[hoveredPos] - Utils.drawStringCentered( - "§b" + pos.internalName, Minecraft.getMinecraft().fontRendererObj, - (scaledResolution.scaledWidth / 2).toFloat(), 18f, true, 0xffffff - ) - val location = "§7x: §e${pos.rawX}§7, y: §e${pos.rawY}" - Utils.drawStringCentered( - location, Minecraft.getMinecraft().fontRendererObj, - (scaledResolution.scaledWidth / 2).toFloat(), 28f, true, 0xffffff - ) - } } + GlStateManager.popMatrix() + + var displayPos = -1 + if (clickedPos != -1) { + if (positions[clickedPos].clicked) { + displayPos = clickedPos + } + } + if (displayPos == -1) { + displayPos = hoveredPos + } + + if (displayPos != -1) { + val pos = positions[displayPos] + Utils.drawStringCentered( + "§b" + pos.internalName, Minecraft.getMinecraft().fontRendererObj, + (scaledResolution.scaledWidth / 2).toFloat(), 18f, true, 0xffffff + ) + val location = "§7x: §e${pos.rawX}§7, y: §e${pos.rawY}" + Utils.drawStringCentered( + location, Minecraft.getMinecraft().fontRendererObj, + (scaledResolution.scaledWidth / 2).toFloat(), 28f, true, 0xffffff + ) + } } @Throws(IOException::class) -- cgit