Skip to content

Commit

Permalink
Fix some oversights
Browse files Browse the repository at this point in the history
  • Loading branch information
Feodor0090 committed Sep 4, 2023
1 parent 25dfda8 commit 706a526
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/mahomaps/screens/MapCanvas.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,16 @@ public class MapCanvas extends MultitouchCanvas implements CommandListener {
private final Runnable repeatAction = new Runnable() {
public void run() {
try {
Thread.sleep(100); // wait a little before repeats
Thread.sleep(200); // wait a little before repeats
while (true) {
Thread.sleep(33); // interruption will throw here stopping the thread
Thread.sleep(16); // interruption will throw here stopping the thread
if (!mapFocused) {
synchronized (repeatAction) {
repeatThread = null;
return;
}
}
int val = Math.max(50, repeatCount * 2);
int val = Math.min(20, repeatCount / 3);
if ((keysState & 1) != 0)
state.yOffset += val;
if ((keysState & 2) != 0)
Expand Down Expand Up @@ -553,7 +553,6 @@ protected void keyReleased(int k) {
tryStopRepeatThread(false);
break;
}
repeatCount = 0;
requestRepaint();
}

Expand Down Expand Up @@ -677,6 +676,7 @@ private final void tryStartRepeatThread() {
synchronized (repeatAction) {
if (keysState != 0 && repeatThread == null) {
Thread t = new Thread(repeatAction, "Key repeat");
repeatCount = 0;
t.start();
repeatThread = t;
}
Expand Down

0 comments on commit 706a526

Please sign in to comment.