diff --git a/src/main/java/noppes/npcs/client/gui/util/GuiScriptTextArea.java b/src/main/java/noppes/npcs/client/gui/util/GuiScriptTextArea.java index c7dee0f26..3426bcae8 100644 --- a/src/main/java/noppes/npcs/client/gui/util/GuiScriptTextArea.java +++ b/src/main/java/noppes/npcs/client/gui/util/GuiScriptTextArea.java @@ -134,7 +134,9 @@ public class GuiScriptTextArea extends GuiNpcTextField { int xOffset = hasVerticalScrollbar() ? -8 : -2; KEYS_OVERLAY.scale = 0.75f; KEYS_OVERLAY.borderCol1 = KEYS_OVERLAY.borderCol2 = 0xFF3c3c3c; - KEYS_OVERLAY.initGui(x + (width / 4), y + 20, endX - (width / 4) + 5, endY - 28); + int overlayWidth = 160; + KEYS_OVERLAY.initGui(x + (width - overlayWidth) / 2 + 5, y + height / 10, overlayWidth, + height - height / 5 - 10); KEYS_OVERLAY.viewButton.scale = 0.45f; KEYS_OVERLAY.viewButton.initGui(endX + xOffset, endY - 26); diff --git a/src/main/java/noppes/npcs/client/gui/util/key/OverlayKeyPresetViewer.java b/src/main/java/noppes/npcs/client/gui/util/key/OverlayKeyPresetViewer.java index 96d6ece84..e8fefd475 100644 --- a/src/main/java/noppes/npcs/client/gui/util/key/OverlayKeyPresetViewer.java +++ b/src/main/java/noppes/npcs/client/gui/util/key/OverlayKeyPresetViewer.java @@ -48,13 +48,13 @@ public class OverlayKeyPresetViewer { }); } - public void initGui(int startX, int startY, int endX, int endY) { + public void initGui(int startX, int startY, int width, int height) { this.startX = startX; this.startY = startY; - this.endX = endX; - this.endY = endY; - this.width = endX - startX; - this.height = endY - startY; + this.width = width; + this.height = height; + this.endX = startX + width; + this.endY = startY + height; scroll.init(); } @@ -454,7 +454,7 @@ public class OverlayKeyPresetViewer { } public int getMaxStringWidth() { - return (int) (getWidth() * RELATIVE_MAX_DESC_WIDTH); + return (int) Math.max(getWidth() * RELATIVE_MAX_DESC_WIDTH, 0); } }