Skip to content

Commit

Permalink
Working on map dragging again.
Browse files Browse the repository at this point in the history
It seems on windows, dragging is fubar.
  • Loading branch information
tyra314 committed Sep 18, 2022
1 parent ba1ba28 commit 7ab7905
Showing 1 changed file with 8 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -730,25 +730,17 @@ public boolean mouseDragged(double mouseX, double mouseY, int lastMouseButton, d
mapOffsetDeltaX += deltaX;
mapOffsetDeltaY += deltaY;

if (mapOffsetDeltaX > 1) {
mapOffsetX++;
mapOffsetDeltaX -= 1;
}

if (mapOffsetDeltaX < -1) {
mapOffsetX--;
mapOffsetDeltaX += 1;
}

int offsetX = (int) (Math.signum(mapOffsetDeltaX) * Math.floor(Math.abs(mapOffsetDeltaX)));
int offsetY = (int) (Math.signum(mapOffsetDeltaY) * Math.floor(Math.abs(mapOffsetDeltaY)));

if (mapOffsetDeltaY > 1) {
mapOffsetY++;
mapOffsetDeltaY -= 1;
if (Math.abs(mapOffsetDeltaX) >= 1) {
mapOffsetDeltaX = mapOffsetDeltaX - offsetX;
mapOffsetX += offsetX;
}

if (mapOffsetDeltaY < -1) {
mapOffsetY--;
mapOffsetDeltaY += 1;
if (Math.abs(mapOffsetDeltaY) >= 1) {
mapOffsetDeltaY = mapOffsetDeltaY - offsetY;
mapOffsetY += offsetY;
}

result = true;
Expand Down

0 comments on commit 7ab7905

Please sign in to comment.