From 494a616f3579c4518e1aa084cbfe97c2a5f6d968 Mon Sep 17 00:00:00 2001 From: noil Date: Sat, 9 Jan 2021 01:03:29 -0500 Subject: [PATCH] SliderComponent: Works with resizing now --- .../seppuku/api/gui/hud/component/SliderComponent.java | 4 ++++ .../impl/gui/hud/component/module/ModuleListComponent.java | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/SliderComponent.java b/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/SliderComponent.java index 52fd17e..2a98acf 100644 --- a/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/SliderComponent.java +++ b/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/SliderComponent.java @@ -24,6 +24,7 @@ public final class SliderComponent extends HudComponent { protected final DecimalFormat decimalFormat = new DecimalFormat("#.#"); protected boolean sliding; protected float lastPositionX = -1; + protected float lastWidth = -1; public SliderComponent(String name, Value value) { super(name); @@ -53,6 +54,9 @@ public final class SliderComponent extends HudComponent { if (this.getX() != this.lastPositionX) { this.sliderBar.updatePositionToValue(); this.lastPositionX = this.getX(); + } else if (this.getW() != this.lastWidth) { + this.sliderBar.updatePositionToValue(); + this.lastWidth = this.getW(); } } else { if (mouseX < this.getX() || mouseX > this.getX() + this.getW()) { // mouse must be inside X at all times to slide diff --git a/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/module/ModuleListComponent.java b/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/module/ModuleListComponent.java index 421896a..593eff8 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/module/ModuleListComponent.java +++ b/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/module/ModuleListComponent.java @@ -52,7 +52,7 @@ public final class ModuleListComponent extends ResizableHudComponent { private ModuleSettingsComponent currentSettings; public ModuleListComponent(Module.ModuleType type) { - super(StringUtils.capitalize(type.name().toLowerCase()), 100, 100, 150, 1000); + super(StringUtils.capitalize(type.name().toLowerCase()), 100, 100, 150, 400); this.type = type; this.originalName = StringUtils.capitalize(type.name().toLowerCase()); this.hudEditorModule = (HudEditorModule) Seppuku.INSTANCE.getModuleManager().find(HudEditorModule.class);