mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 07:35:11 +00:00
Moved fullScreenButton rendering into GuiScriptTextArea
This commit is contained in:
1 parent
ef51f4acd8
commit
9886dae519
2 files changed
+14
-12
No files matched your search
@@ -6,7 +6,6 @@ import net.minecraft.client.gui.GuiYesNo;
|
||||
import net.minecraft.client.gui.GuiYesNoCallback;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.NoppesStringUtils;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
@@ -30,7 +29,6 @@ import noppes.npcs.controllers.data.ForgeDataScript;
|
||||
import noppes.npcs.controllers.data.IScriptHandler;
|
||||
import noppes.npcs.scripted.item.ScriptCustomItem;
|
||||
import org.lwjgl.opengl.Display;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
@@ -71,7 +69,7 @@ public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallb
|
||||
}
|
||||
|
||||
/** Fullscreen toggle button drawn at top-right of viewport */
|
||||
private final FullscreenButton fullscreenButton = new FullscreenButton();
|
||||
public final FullscreenButton fullscreenButton = new FullscreenButton();
|
||||
|
||||
public GuiScriptInterface() {
|
||||
this.drawDefaultBackground = true;
|
||||
@@ -270,28 +268,24 @@ public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallb
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
|
||||
// Draw fullscreen button on top of everything when on script editor tab
|
||||
if (this.activeTab > 0) {
|
||||
fullscreenButton.draw(mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
||||
// ==================== MOUSE HANDLING ====================
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void mouseClicked(int mouseX, int mouseY, int mouseButton) {
|
||||
// Check if click is within autocomplete menu bounds and consume it if so
|
||||
GuiScriptTextArea activeArea = getActiveScriptArea();
|
||||
if (activeArea != null && activeArea.isClickInAutocompleteMenu(mouseX, mouseY)) {
|
||||
boolean isOverAutocomplete = activeArea != null
|
||||
&& activeArea.isPointOnAutocompleteMenu(mouseX, mouseY);
|
||||
if (isOverAutocomplete) {
|
||||
activeArea.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check fullscreen button first when on script editor tab
|
||||
// BUT only if autocomplete is not visible (don't let clicks pass through autocomplete menu)
|
||||
if (this.activeTab > 0 && (activeArea == null || !activeArea.isAutocompleteVisible())
|
||||
if (this.activeTab > 0 && !isOverAutocomplete
|
||||
&& fullscreenButton.mouseClicked(mouseX, mouseY, mouseButton)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -47,6 +47,8 @@ import static net.minecraft.client.gui.GuiScreen.isCtrlKeyDown;
|
||||
* - CursorNavigation: cursor movement logic
|
||||
*/
|
||||
public class GuiScriptTextArea extends GuiNpcTextField {
|
||||
|
||||
private GuiScriptInterface parent;
|
||||
|
||||
// ==================== DIMENSIONS & POSITION ====================
|
||||
public int x;
|
||||
@@ -129,6 +131,9 @@ public class GuiScriptTextArea extends GuiNpcTextField {
|
||||
public GuiScriptTextArea(GuiScreen guiScreen, int id, int x, int y, int width, int height, String text) {
|
||||
super(id, guiScreen, x, y, width, height, null);
|
||||
init(x, y, width, height, text);
|
||||
|
||||
if (guiScreen instanceof GuiScriptInterface)
|
||||
this.parent = (GuiScriptInterface) guiScreen;
|
||||
}
|
||||
|
||||
public void init(int x, int y, int width, int height, String text) {
|
||||
@@ -961,6 +966,9 @@ public class GuiScriptTextArea extends GuiNpcTextField {
|
||||
drawRect(posX, posY, posX + 5, posY + sbSize + 2, 0xFFe0e0e0);
|
||||
}
|
||||
|
||||
if (parent != null)
|
||||
parent.fullscreenButton.draw(xMouse, yMouse);
|
||||
|
||||
// Draw search/replace bar (overlays viewport)
|
||||
searchBar.draw(xMouse, yMouse);
|
||||
|
||||
@@ -2496,7 +2504,7 @@ public class GuiScriptTextArea extends GuiNpcTextField {
|
||||
* Check if a click position is within the bounds of the autocomplete menu.
|
||||
* Returns false if autocomplete is not visible.
|
||||
*/
|
||||
public boolean isClickInAutocompleteMenu(int mouseX, int mouseY) {
|
||||
public boolean isPointOnAutocompleteMenu(int mouseX, int mouseY) {
|
||||
if (autocompleteManager == null || !autocompleteManager.isVisible()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user