diff options
author | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-04-04 14:53:10 +0200 |
---|---|---|
committer | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-04-04 14:53:10 +0200 |
commit | ddca3a3232eff15a7130efda03e7e5c408554412 (patch) | |
tree | ef7678412590ca432bb2cd25aabfc3bf2ea4b7b0 /src/main/java/io/polyfrost/oneconfig/hud/gui/HudGui.java | |
parent | 1210e38c2ff569a28b20d7d0182557fbf386d524 (diff) | |
parent | 2696141f9790fd6c8d3df1148f46d298512c4902 (diff) | |
download | OneConfig-ddca3a3232eff15a7130efda03e7e5c408554412.tar.gz OneConfig-ddca3a3232eff15a7130efda03e7e5c408554412.tar.bz2 OneConfig-ddca3a3232eff15a7130efda03e7e5c408554412.zip |
merge
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig/hud/gui/HudGui.java')
-rw-r--r-- | src/main/java/io/polyfrost/oneconfig/hud/gui/HudGui.java | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/src/main/java/io/polyfrost/oneconfig/hud/gui/HudGui.java b/src/main/java/io/polyfrost/oneconfig/hud/gui/HudGui.java index 6e1ce6c..7620a26 100644 --- a/src/main/java/io/polyfrost/oneconfig/hud/gui/HudGui.java +++ b/src/main/java/io/polyfrost/oneconfig/hud/gui/HudGui.java @@ -47,10 +47,8 @@ public class HudGui extends GuiScreen { float pos = getXSnapping(mouseX, true); float newWidth = pos - xFloat; float newScale = newWidth / ((hud.getWidth(hud.scale) + hud.paddingX * hud.scale) / hud.scale); - if (newScale > 20) - newScale = 20; - else if (newScale < 0.3) - newScale = 0.3f; + if (newScale > 20) newScale = 20; + else if (newScale < 0.3) newScale = 0.3f; hud.scale = newScale; if (xFloat / this.width > 0.5) @@ -68,8 +66,7 @@ public class HudGui extends GuiScreen { int color = new Color(215, 224, 235).getRGB(); if (editingHud == hud) { color = new Color(43, 159, 235).getRGB(); - if (isDragging) - Gui.drawRect(x, y, x + width, y + height, new Color(108, 176, 255, 60).getRGB()); + if (isDragging) Gui.drawRect(x, y, x + width, y + height, new Color(108, 176, 255, 60).getRGB()); } Renderer.drawLine(x - 2 / 4f, y, x + width + 2 / 4f, y, 2, color); Renderer.drawLine(x, y, x, y + height, 2, color); @@ -87,28 +84,20 @@ public class HudGui extends GuiScreen { float width = editingHud.getWidth(editingHud.scale) + editingHud.paddingX * editingHud.scale; float height = editingHud.getHeight(editingHud.scale) + editingHud.paddingY * editingHud.scale; - if (newX < 0) - newX = 0; - else if (newX + width > this.width) - newX = this.width - width; - if (newY < 0) - newY = 0; - else if (newY + height > this.height) - newY = this.height - height; + if (newX < 0) newX = 0; + else if (newX + width > this.width) newX = this.width - width; + if (newY < 0) newY = 0; + else if (newY + height > this.height) newY = this.height - height; if (snap) { newX = getXSnapping(newX, false); newY = getYSnapping(newY); } - if (newX / this.width <= 0.5) - editingHud.xUnscaled = newX / (double) this.width; - else - editingHud.xUnscaled = (newX + width) / (double) this.width; - if (newY / this.height <= 0.5) - editingHud.yUnscaled = newY / (double) this.height; - else - editingHud.yUnscaled = (newY + height) / (double) this.height; + if (newX / this.width <= 0.5) editingHud.xUnscaled = newX / (double) this.width; + else editingHud.xUnscaled = (newX + width) / (double) this.width; + if (newY / this.height <= 0.5) editingHud.yUnscaled = newY / (double) this.height; + else editingHud.yUnscaled = (newY + height) / (double) this.height; } private float getXSnapping(float pos, boolean rightOnly) { |