Fixed grid mouse wheel code running outside of grid

This commit is contained in:
bigguy345 committed 2025-03-18 06:19:03 +02:00
1 parent a4bca99126
commit 5f04b6fa69
1 file changed
+5 -1
@@ -104,7 +104,7 @@ public class Grid {
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
// Zoom logic
if (wheel != 0 && !parent.presetOverlay.showOverlay) {
if (wheel != 0 && !parent.presetOverlay.showOverlay&& isMouseOver(mouseX,mouseY)) {
float xRate = zoomX < 15 ? 1.1f : 1.25f;
float yRate = zoomY < 15 ? 1.1f : 1.25f;
@@ -157,6 +157,10 @@ public class Grid {
GL11.glDisable(GL11.GL_SCISSOR_TEST);
}
public boolean isMouseOver(int mouseX, int mouseY) {
return mouseX >= startX && mouseX <= startX + width && mouseY >= startY && mouseY <= startY + height;
}
public void zoom(int mouseX, int mouseY, int wheel) {
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////