From 2578ce1cf6c6ce5839a2bc2baa4835ea21911233 Mon Sep 17 00:00:00 2001 From: bigguy345 Date: Wed, 4 Mar 2026 22:56:10 +0200 Subject: [PATCH] feat(hover): wire tooltip scrollbar drag into GuiScriptTextArea input handling - drawTextBox: update scrollbar drag each frame via Mouse.isButtonDown(0), release drag when button lifted (mirrors existing ScrollState pattern) - mouseClicked: intercept LMB on tooltip scrollbar thumb before text interaction Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus --- .../npcs/client/gui/util/GuiScriptTextArea.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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 d6a7d4626..0e6231c97 100644 --- a/src/main/java/noppes/npcs/client/gui/util/GuiScriptTextArea.java +++ b/src/main/java/noppes/npcs/client/gui/util/GuiScriptTextArea.java @@ -652,6 +652,14 @@ public class GuiScriptTextArea extends GuiNpcTextField { hoverState.clearHover(); } } + // Handle tooltip scrollbar drag (update each frame; release when button lifted) + if (hoverState.isDraggingScrollbar()) { + if (Mouse.isButtonDown(0)) { + hoverState.updateScrollbarDrag(yMouse); + } else { + hoverState.releaseScrollbarDrag(); + } + } // Update scroll animation scroll.initializeIfNeeded(scroll.getScrolledLine()); @@ -2894,6 +2902,12 @@ public class GuiScriptTextArea extends GuiNpcTextField { if (KEYS_OVERLAY.mouseClicked(xMouse, yMouse, mouseButton)) return; + // Check tooltip scrollbar click (highest priority — before text interaction) + if (mouseButton == 0 && hoverState.isTooltipVisible() + && hoverState.isMouseOverScrollbarThumb(xMouse, yMouse)) { + hoverState.startScrollbarDrag(yMouse); + return; + } // Determine whether click occurred inside the text area bounds this.active = xMouse >= this.x && xMouse < this.x + this.width && yMouse >= this.y && yMouse < this.y + this.height; if (this.active) {