diff options
author | Juuz <6596629+Juuxel@users.noreply.github.com> | 2022-09-06 14:26:16 +0300 |
---|---|---|
committer | Juuz <6596629+Juuxel@users.noreply.github.com> | 2022-09-06 14:26:16 +0300 |
commit | 76344e9eb57b77c3ef2a6405e8c9752c959d2d0e (patch) | |
tree | 60e51ca575254c54ffcf4991813857f51ec436be /src/main/java | |
parent | 82950d5b4a58699ae816b5279c27d344d9e98185 (diff) | |
download | LibGui-76344e9eb57b77c3ef2a6405e8c9752c959d2d0e.tar.gz LibGui-76344e9eb57b77c3ef2a6405e8c9752c959d2d0e.tar.bz2 LibGui-76344e9eb57b77c3ef2a6405e8c9752c959d2d0e.zip |
Use WWidget.isWithinBounds in WPanel.hit
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/io/github/cottonmc/cotton/gui/widget/WPanel.java | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WPanel.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WPanel.java index b6d0169..a853b24 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WPanel.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WPanel.java @@ -104,11 +104,10 @@ public abstract class WPanel extends WWidget { if (children.isEmpty()) return this; for(int i=children.size()-1; i>=0; i--) { //Backwards so topmost widgets get priority WWidget child = children.get(i); - if ( x>=child.getX() && - y>=child.getY() && - x<child.getX()+child.getWidth() && - y<child.getY()+child.getHeight()) { - return child.hit(x-child.getX(), y-child.getY()); + int wx = x - child.getX(); + int wy = y - child.getY(); + if (child.isWithinBounds(wx, wy)) { + return child.hit(wx, wy); } } return this; |