Skip to content

Commit

Permalink
Merge pull request #59 from ConsoleLogLuke/toggle-selection-gui
Browse files Browse the repository at this point in the history
Make emoji selection GUI togglable by re-clicking the button
  • Loading branch information
Buuz135 authored Oct 29, 2022
2 parents b9fd049 + 720207f commit f094178
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ public void render(PoseStack stack) {

@Override
public boolean mouseClicked(double mouseX, double mouseY, int p_231044_5_) {
if (openSelectionArea.contains((int) mouseX, (int) mouseY)) {
toggleSelectionArea();
return true;
}

if (this.showingSelectionArea) {
fieldWidget.setFocus(textFieldRectangle.contains((int) mouseX, (int) mouseY));
if (categorySelectionArea.contains((int) mouseX, (int) mouseY)) {
Expand Down Expand Up @@ -161,11 +166,6 @@ public boolean mouseClicked(double mouseX, double mouseY, int p_231044_5_) {
}
return true;
}
} else {
if (openSelectionArea.contains((int) mouseX, (int) mouseY)) {
showSelectionArea();
return true;
}
}
return false;
}
Expand Down Expand Up @@ -201,7 +201,7 @@ public void drawRectangle(PoseStack stack, Rect2i rectangle2d, int value) {
GuiComponent.fill(stack, rectangle2d.getX(), rectangle2d.getY(), rectangle2d.getX() + rectangle2d.getWidth(), rectangle2d.getY() + rectangle2d.getHeight(), value);
}

public void showSelectionArea() {
public void toggleSelectionArea() {
Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK, 1.0F));
showingSelectionArea = !showingSelectionArea;
}
Expand Down

0 comments on commit f094178

Please sign in to comment.