Skip to content

Commit

Permalink
Fix Align / Valign location clamping
Browse files Browse the repository at this point in the history
  • Loading branch information
nightm4re94 committed Mar 4, 2025
1 parent 899016e commit cee53ea
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public double getLocation(final double width, final double objectWidth, final bo
return location;
}

return Math.clamp(location, 0, width - objectWidth);
return Math.max(0, Math.min(width - objectWidth, location));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public double getLocation(final double height, final double objectHeight, final
return location;
}

return Math.clamp(location, 0, height - objectHeight);
return Math.max(0, Math.min(height - objectHeight, location));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class AlignTests {
private Align alignObject;

@BeforeEach
public void initAlign() {
void initAlign() {
alignObject = Align.get("right"); // portion = 1
}

Expand Down

0 comments on commit cee53ea

Please sign in to comment.