Skip to content

Commit

Permalink
Make sure elements can't be too small
Browse files Browse the repository at this point in the history
  • Loading branch information
Sychic committed Apr 23, 2021
1 parent 5f0a104 commit 0485f6b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/skytils/skytilsmod/gui/LocationEditGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ protected void onMouseMove(int mouseX, int mouseY) {
float scaleX = newWidth / width;
float scaleY = newHeight / height;

float newScale = Math.max(scaleX, scaleY);
float newScale = Math.max(scaleX, scaleY) > 0 ? Math.max(scaleX, scaleY) : 0.01f;

locationButton.element.setScale(scaleCache + newScale);
locationButton.drawButton(mc, mouseX, mouseY);
Expand Down Expand Up @@ -243,8 +243,8 @@ private void recalculateResizeButtons() {
public void handleMouseInput() throws IOException {
super.handleMouseInput();
GuiElement hovered = LocationButton.lastHoveredElement;
if (hovered != null) {
hovered.setScale(hovered.getScale() + (Mouse.getEventDWheel() / 1_000f));
if (hovered != null && (hovered.getScale() + (Mouse.getEventDWheel() / 1_000f) > 0)) {
hovered.setScale( hovered.getScale() + (Mouse.getEventDWheel() / 1_000f));
}
}

Expand Down

0 comments on commit 0485f6b

Please sign in to comment.