mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 15:27:29 +00:00
Dynamically calculated gutter width based on line number digits
This commit is contained in:
1 parent
9afe569677
commit
492bec21c3
1 file changed
+8
@@ -76,6 +76,14 @@ public class GuiScriptTextArea extends GuiNpcTextField {
|
||||
if (!visible)
|
||||
return;
|
||||
clampSelectionBounds();
|
||||
|
||||
// Dynamically calculate gutter width based on line count digits
|
||||
if (container != null && container.linesCount > 0) {
|
||||
int maxLineNum = container.linesCount;
|
||||
String maxLineStr = String.valueOf(maxLineNum);
|
||||
int digitWidth = ClientProxy.Font.width(maxLineStr);
|
||||
LINE_NUMBER_GUTTER_WIDTH = digitWidth + 10; // 10px total padding (5px left + 5px right)
|
||||
}
|
||||
// Draw outer border around entire area
|
||||
drawRect(x - 1, y - 1, x + width + 1, y + height + 1, 0xffa0a0a0);
|
||||
// Draw line number gutter background
|
||||
|
||||
Reference in new issue
Block a user