Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix fixed scale mouse click #62

Merged
merged 1 commit into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions shared/java/top/fpsmaster/ui/click/MainPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ public void render(int mouseX, int mouseY, float partialTicks) {
}

if (drag) {
x = (int) (mouseX - dragX);
mouseY -= (int) dragY;
x = (int) (mouseX - dragX);
y = mouseY;
}

float w = mouseX + sizeDragX - x;
float h = mouseY + sizeDragY - y;

if (sizeDrag) {
float w = mouseX + sizeDragX - x;
float h = mouseY + sizeDragY - y;
width = w;
height = h;
}
Expand Down Expand Up @@ -369,7 +369,7 @@ public void keyTyped(char typedChar, int keyCode) throws IOException {
}

@Override
public void mouseClicked(int mouseX, int mouseY, int mouseButton) {
public void onClick(int mouseX, int mouseY, int mouseButton) {
if (!Render2DUtils.isHoveredWithoutScale(x, y, width, height, mouseX, mouseY)) return;

if (mouseButton == 0 && Render2DUtils.isHoveredWithoutScale(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public void drawScreen(int mouseX, int mouseY, float partialTicks) {
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
super.mouseClicked(mouseX, mouseY, mouseButton);
ScaledResolution sr = new ScaledResolution(mc);

int realMouseX = mouseX * scaleFactor / 2;
int realMouseY = mouseY * scaleFactor / 2;
onClick(realMouseX, realMouseY, mouseButton);
Expand Down