Fixes tooltip bugs

This commit is contained in:
noil 2020-12-30 14:46:22 -05:00
parent b292dfd16c
commit 62882ed033
2 changed files with 11 additions and 7 deletions

View File

@ -29,7 +29,7 @@ public class ToolTipComponent extends HudComponent {
super.render(mouseX, mouseY, partialTicks); super.render(mouseX, mouseY, partialTicks);
if (this.alpha < 0xFF/*max alpha*/) { if (this.alpha < 0xFF/*max alpha*/) {
this.alpha += 1/* arbitrary value, the speed at which it fades in essentially */; this.alpha += 2/* arbitrary value, the speed at which it fades in essentially */;
} }
if (this.alpha > 0x99/* another arbitrary value, the alpha hex value at which it begins to show on screen*/) { if (this.alpha > 0x99/* another arbitrary value, the alpha hex value at which it begins to show on screen*/) {

View File

@ -226,14 +226,10 @@ public final class ModuleListComponent extends ResizableHudComponent {
this.currentToolTip.render(mouseX, mouseY, partialTicks); this.currentToolTip.render(mouseX, mouseY, partialTicks);
} }
} else { } else {
if (this.currentToolTip != null) { this.removeTooltip();
this.currentToolTip = null;
}
} }
} else { } else {
if (this.currentToolTip != null) { this.removeTooltip();
this.currentToolTip = null;
}
} }
} }
//RenderUtil.end2D(); //RenderUtil.end2D();
@ -261,6 +257,7 @@ public final class ModuleListComponent extends ResizableHudComponent {
switch (button) { switch (button) {
case 0: case 0:
if (mouseX >= (this.getX() + this.getW() - BORDER - SCROLL_WIDTH - 12) && mouseX <= (this.getX() + this.getW() - BORDER - SCROLL_WIDTH - 1)) { if (mouseX >= (this.getX() + this.getW() - BORDER - SCROLL_WIDTH - 12) && mouseX <= (this.getX() + this.getW() - BORDER - SCROLL_WIDTH - 1)) {
this.removeTooltip();
this.currentSettings = new ModuleSettingsComponent(module, this); this.currentSettings = new ModuleSettingsComponent(module, this);
this.setOldScroll(this.getScroll()); this.setOldScroll(this.getScroll());
this.setScroll(0); this.setScroll(0);
@ -270,6 +267,7 @@ public final class ModuleListComponent extends ResizableHudComponent {
this.setDragging(false); this.setDragging(false);
break; break;
case 1: case 1:
this.removeTooltip();
this.currentSettings = new ModuleSettingsComponent(module, this); this.currentSettings = new ModuleSettingsComponent(module, this);
this.setOldScroll(this.getScroll()); this.setOldScroll(this.getScroll());
this.setScroll(0); this.setScroll(0);
@ -343,6 +341,11 @@ public final class ModuleListComponent extends ResizableHudComponent {
} }
} }
public void removeTooltip() {
if (this.currentToolTip != null)
this.currentToolTip = null;
}
public Module.ModuleType getType() { public Module.ModuleType getType() {
return type; return type;
} }
@ -418,6 +421,7 @@ public final class ModuleListComponent extends ResizableHudComponent {
ModuleListComponent moduleList = (ModuleListComponent) component; ModuleListComponent moduleList = (ModuleListComponent) component;
if (moduleList.getName().equals(parentModuleList.getName())) { if (moduleList.getName().equals(parentModuleList.getName())) {
moduleList.currentSettings = null; moduleList.currentSettings = null;
moduleList.removeTooltip();
} }
} }
} }