diff options
author | syeyoung <cyong06@naver.com> | 2020-12-30 13:57:53 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2020-12-30 13:57:53 +0900 |
commit | 00c92d34b5373441f798da15341d5606693be684 (patch) | |
tree | 652e3bc9733b955d97fab9ae453a709330ebec17 | |
parent | 0ab8c554c9fa40aa7830aa1ff614673562bb21a4 (diff) | |
download | Skyblock-Dungeons-Guide-00c92d34b5373441f798da15341d5606693be684.tar.gz Skyblock-Dungeons-Guide-00c92d34b5373441f798da15341d5606693be684.tar.bz2 Skyblock-Dungeons-Guide-00c92d34b5373441f798da15341d5606693be684.zip |
use clip
8 files changed, 11 insertions, 6 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/MPanel.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/MPanel.java index d5586ce3..8a7a3fd2 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/MPanel.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/MPanel.java @@ -24,6 +24,8 @@ public class MPanel { protected Color backgroundColor = new Color(0,0,0,0); + protected Rectangle lastAbsClip = new Rectangle(0,0,0,0); + @Getter(AccessLevel.PUBLIC) protected boolean isFocused; @@ -84,6 +86,7 @@ public class MPanel { Rectangle absBound = bounds.getBounds(); absBound.setLocation(absBound.x + parentPoint.x, absBound.y + parentPoint.y); Rectangle clip = determineClip(parentClip, absBound); + lastAbsClip = clip; clip(resolution, clip.x, clip.y, clip.width, clip.height); GL11.glPushAttrib(GL11.GL_SCISSOR_BIT); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MButton.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MButton.java index 18aeef41..0334895f 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MButton.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MButton.java @@ -48,7 +48,7 @@ public class MButton extends MPanel { @Override public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) { - if (onActionPerformed != null && new Rectangle(new Point(0,0),getSize()).contains(relMouseX, relMouseY)) + if (onActionPerformed != null && lastAbsClip.contains(absMouseX, absMouseY)) onActionPerformed.run(); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MLabelAndElement.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MLabelAndElement.java index 7a284433..af3fe01d 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MLabelAndElement.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MLabelAndElement.java @@ -32,7 +32,7 @@ public class MLabelAndElement extends MPanel { @Override public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) { - if (onClick!= null && new Rectangle(new Point(0,0),bounds.getSize()).contains(relMouseX, relMouseY)) { + if (onClick!= null && lastAbsClip.contains(absMouseX, absMouseY)) { onClick.run(); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MParameter.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MParameter.java index fef77a25..f22bbc99 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MParameter.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MParameter.java @@ -51,7 +51,7 @@ public class MParameter extends MPanel { @Override public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) { - if (this.bounds.x > -20 && new Rectangle(new Point(0,0),bounds.getSize()).contains(relMouseX, relMouseY)) { + if (this.bounds.x > -20 && lastAbsClip.contains(absMouseX, absMouseY)) { // open new gui; EditingContext.getEditingContext().openGui(new GuiDungeonParameterEdit(this, processorParameterEditPane)); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MTabButton.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MTabButton.java index eee366cc..c21c1ff5 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MTabButton.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MTabButton.java @@ -54,7 +54,7 @@ public class MTabButton extends MPanel { @Override public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) { - if (new Rectangle(new Point(0,0),getSize()).contains(relMouseX, relMouseY)) { + if (lastAbsClip.contains(absMouseX, absMouseY)) { tabbedPane.setSelectedKey(text); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MTextField.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MTextField.java index 39ed0b9f..017f5670 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MTextField.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MTextField.java @@ -74,6 +74,8 @@ public class MTextField extends MPanel { public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) { Rectangle actualField = new Rectangle(1, 3,bounds.width - 2, bounds.height - 6); if (!actualField.contains(relMouseX, relMouseY)) return; + if (!lastAbsClip.contains(absMouseX, absMouseY)) return; + diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MValue.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MValue.java index 9c733fd6..3f8f2ec6 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MValue.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MValue.java @@ -46,7 +46,7 @@ public class MValue<T> extends MPanel { @Override public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) { - if (this.bounds.x > -20 && new Rectangle(new Point(0,0),bounds.getSize()).contains(relMouseX, relMouseY)) { + if (this.bounds.x > -20 && lastAbsClip.contains(absMouseX, absMouseY)) { EditingContext.getEditingContext().openGui(new GuiDungeonValueEdit(data, addons)); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomDataDisplayPane.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomDataDisplayPane.java index be517e81..651097af 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomDataDisplayPane.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomDataDisplayPane.java @@ -91,7 +91,7 @@ public class RoomDataDisplayPane extends MPanel { lastX = absMouseX; lastY = absMouseY; - if (new Rectangle(new Point(0,0),getSize()).contains(relMouseX, relMouseY)) { + if (lastAbsClip.contains(absMouseX, absMouseY)) { selectedX = (relMouseX - offsetX - 10) / 16; selectedY = (relMouseY - offsetY - 10) / 16; } |