Fix[touchpad]: respond to dynamic scale changes

This commit is contained in:
artdeell 2024-11-20 23:24:53 +03:00
parent 3f5baec1e6
commit 924c33cb2c

View File

@ -1,7 +1,6 @@
package net.kdt.pojavlaunch.customcontrols.mouse;
import static net.kdt.pojavlaunch.Tools.currentDisplayMetrics;
import static net.kdt.pojavlaunch.prefs.LauncherPreferences.DEFAULT_PREF;
import android.content.Context;
import android.graphics.Canvas;
@ -29,8 +28,6 @@ public class Touchpad extends View implements GrabListener, AbstractTouchpad {
/* Mouse pointer icon used by the touchpad */
private Drawable mMousePointerDrawable;
private float mMouseX, mMouseY;
/* Resolution scaler option, allow downsizing a window */
private final float mScaleFactor = DEFAULT_PREF.getInt("resolutionRatio",100)/100f;
public Touchpad(@NonNull Context context) {
this(context, null);
}
@ -68,7 +65,7 @@ public class Touchpad extends View implements GrabListener, AbstractTouchpad {
}
private void sendMousePosition() {
CallbackBridge.sendCursorPos((mMouseX * mScaleFactor), (mMouseY * mScaleFactor));
CallbackBridge.sendCursorPos((mMouseX * LauncherPreferences.PREF_SCALE_FACTOR), (mMouseY * LauncherPreferences.PREF_SCALE_FACTOR));
}
private void updateMousePosition() {