Skip to content

Commit

Permalink
SD mode respect mouse speed preferences
Browse files Browse the repository at this point in the history
  • Loading branch information
downthecrop committed Nov 2, 2023
1 parent 793d2e4 commit aed8217
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/build
/*/build
app_pojavlauncher/src/main/assets/components/jre
app_pojavlauncher/src/main/assets/components/lwjgl3/version
local.properties
.idea/
.DS_Store
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.kdt.pojavlaunch;

import static net.kdt.pojavlaunch.MainActivity.fullyExit;
import static net.kdt.pojavlaunch.Tools.currentDisplayMetrics;

import android.annotation.SuppressLint;
import android.content.ClipboardManager;
Expand Down Expand Up @@ -101,11 +102,13 @@ public boolean onTouch(View v, MotionEvent event) {
// interested in events where the touch position changed.
// int index = event.getActionIndex();
int action = event.getActionMasked();
float mouseSpeed = LauncherPreferences.PREF_MOUSESPEED;

float x = event.getX();
float y = event.getY();
float mouseX, mouseY;

// Scale the mouse speed
mouseX = mMousePointerImageView.getX();
mouseY = mMousePointerImageView.getY();

Expand All @@ -117,8 +120,8 @@ public boolean onTouch(View v, MotionEvent event) {
}
} else {
if (action == MotionEvent.ACTION_MOVE) { // 2
mouseX = Math.max(0, Math.min(CallbackBridge.physicalWidth, mouseX + x - prevX));
mouseY = Math.max(0, Math.min(CallbackBridge.physicalHeight, mouseY + y - prevY));
mouseX = Math.max(0, Math.min(currentDisplayMetrics.widthPixels, mouseX + (x - prevX) * LauncherPreferences.PREF_MOUSESPEED));
mouseY = Math.max(0, Math.min(currentDisplayMetrics.heightPixels, mouseY + (y - prevY) * LauncherPreferences.PREF_MOUSESPEED));
placeMouseAt(mouseX, mouseY);
sendScaledMousePosition(mouseX, mouseY);
}
Expand Down

0 comments on commit aed8217

Please sign in to comment.