From 2c1224eec008e6841d62d5976566f54c8a6c8fcf Mon Sep 17 00:00:00 2001 From: mezz Date: Thu, 18 Sep 2014 01:51:23 -0700 Subject: [PATCH] Fixed tooltip background being too short for long tooltips --- .../java/forestry/core/gui/GuiForestry.java | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/src/main/java/forestry/core/gui/GuiForestry.java b/src/main/java/forestry/core/gui/GuiForestry.java index 0851bf031..b8eec636f 100755 --- a/src/main/java/forestry/core/gui/GuiForestry.java +++ b/src/main/java/forestry/core/gui/GuiForestry.java @@ -320,38 +320,40 @@ public abstract class GuiForestry extends GuiContainer { int left = this.guiLeft; int top = this.guiTop; - int lenght = 0; + int length = 0; + int height = 0; int x; int y; for (ToolTipLine tip : toolTips) { y = this.fontRendererObj.getStringWidth(tip.text); - if (y > lenght) - lenght = y; + height += 10 + tip.getSpacing(); + if (y > length) + length = y; } x = mouseX - left + 12; y = mouseY - top - 12; - int var14 = 8; - - if (toolTips.size() > 1) - var14 += 2 + (toolTips.size() - 1) * 10; this.zLevel = 300.0F; itemRender.zLevel = 300.0F; - int var15 = -267386864; - this.drawGradientRect(x - 3, y - 4, x + lenght + 3, y - 3, var15, var15); - this.drawGradientRect(x - 3, y + var14 + 3, x + lenght + 3, y + var14 + 4, var15, var15); - this.drawGradientRect(x - 3, y - 3, x + lenght + 3, y + var14 + 3, var15, var15); - this.drawGradientRect(x - 4, y - 3, x - 3, y + var14 + 3, var15, var15); - this.drawGradientRect(x + lenght + 3, y - 3, x + lenght + 4, y + var14 + 3, var15, var15); - int var16 = 1347420415; - int var17 = (var16 & 16711422) >> 1 | var16 & -16777216; - this.drawGradientRect(x - 3, y - 3 + 1, x - 3 + 1, y + var14 + 3 - 1, var16, var17); - this.drawGradientRect(x + lenght + 2, y - 3 + 1, x + lenght + 3, y + var14 + 3 - 1, var16, var17); - this.drawGradientRect(x - 3, y - 3, x + lenght + 3, y - 3 + 1, var16, var16); - this.drawGradientRect(x - 3, y + var14 + 2, x + lenght + 3, y + var14 + 3, var17, var17); + Color backgroundColor = new Color(16, 0, 16, 240); + int backgroundColorInt = backgroundColor.getRGB(); + this.drawGradientRect(x - 3, y - 4, x + length + 2, y - 3, backgroundColorInt, backgroundColorInt); + this.drawGradientRect(x - 3, y + height + 1, x + length + 2, y + height + 2, backgroundColorInt, backgroundColorInt); + this.drawGradientRect(x - 3, y - 3, x + length + 2, y + height + 1, backgroundColorInt, backgroundColorInt); + this.drawGradientRect(x - 4, y - 3, x - 3, y + height + 1, backgroundColorInt, backgroundColorInt); + this.drawGradientRect(x + length + 2, y - 3, x + length + 3, y + height + 1, backgroundColorInt, backgroundColorInt); + + Color borderColorTop = new Color(80, 0, 255, 80); + int borderColorTopInt = borderColorTop.getRGB(); + Color borderColorBottom = new Color((borderColorTopInt & 0xfefefe) >> 1 | borderColorTopInt & -0x1000000, true); + int borderColorBottomInt = borderColorBottom.getRGB(); + this.drawGradientRect(x - 3, y - 3 + 1, x - 3 + 1, y + height, borderColorTopInt, borderColorBottomInt); + this.drawGradientRect(x + length + 1, y - 3 + 1, x + length + 2, y + height, borderColorTopInt, borderColorBottomInt); + this.drawGradientRect(x - 3, y - 3, x + length + 2, y - 3 + 1, borderColorTopInt, borderColorTopInt); + this.drawGradientRect(x - 3, y + height, x + length + 2, y + height + 1, borderColorBottomInt, borderColorBottomInt); for (ToolTipLine tip : toolTips) { String line = tip.text;