mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-18 00:59:35 -04:00
Fix ALL mouse jumps for hardware mouse;
Yes, it now works as on PC :)
This commit is contained in:
parent
2a75fb1362
commit
7904d91702
@ -106,7 +106,7 @@ public class BaseMainActivity extends LoggableActivity {
|
|||||||
private boolean lastGrab = false;
|
private boolean lastGrab = false;
|
||||||
private boolean isExited = false;
|
private boolean isExited = false;
|
||||||
private boolean isLogAllow = false;
|
private boolean isLogAllow = false;
|
||||||
private int mouse_x, mouse_y;
|
private volatile int mouse_x, mouse_y;
|
||||||
private boolean ignorePad = false;
|
private boolean ignorePad = false;
|
||||||
// private int navBarHeight = 40;
|
// private int navBarHeight = 40;
|
||||||
|
|
||||||
@ -617,7 +617,6 @@ public class BaseMainActivity extends LoggableActivity {
|
|||||||
CallbackBridge.mouseY = mouse_y;
|
CallbackBridge.mouseY = mouse_y;
|
||||||
if(!CallbackBridge.isGrabbing()){
|
if(!CallbackBridge.isGrabbing()){
|
||||||
view.releasePointerCapture();
|
view.releasePointerCapture();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debugText.getVisibility() == View.VISIBLE && !debugErrored) {
|
if (debugText.getVisibility() == View.VISIBLE && !debugErrored) {
|
||||||
@ -767,15 +766,18 @@ public class BaseMainActivity extends LoggableActivity {
|
|||||||
}
|
}
|
||||||
switch(ev.getActionMasked()) {
|
switch(ev.getActionMasked()) {
|
||||||
case MotionEvent.ACTION_HOVER_MOVE:
|
case MotionEvent.ACTION_HOVER_MOVE:
|
||||||
CallbackBridge.mouseX = (int) (ev.getX(mouseCursorIndex)*scaleFactor);
|
mouse_x = (int) (ev.getX(mouseCursorIndex) * scaleFactor);
|
||||||
CallbackBridge.mouseY = (int) (ev.getY(mouseCursorIndex)*scaleFactor);
|
mouse_y = (int) (ev.getY(mouseCursorIndex) * scaleFactor);
|
||||||
CallbackBridge.sendCursorPos((int) (ev.getX(mouseCursorIndex)*scaleFactor), (int) (ev.getY(mouseCursorIndex)*scaleFactor));
|
CallbackBridge.mouseX = mouse_x;
|
||||||
|
CallbackBridge.mouseY = mouse_y;
|
||||||
|
CallbackBridge.sendCursorPos(mouse_x,mouse_y);
|
||||||
|
debugText.setText(CallbackBridge.DEBUG_STRING.toString());
|
||||||
|
CallbackBridge.DEBUG_STRING.setLength(0);
|
||||||
return true;
|
return true;
|
||||||
case MotionEvent.ACTION_SCROLL:
|
case MotionEvent.ACTION_SCROLL:
|
||||||
CallbackBridge.sendScroll((double) ev.getAxisValue(MotionEvent.AXIS_VSCROLL), (double) ev.getAxisValue(MotionEvent.AXIS_HSCROLL));
|
CallbackBridge.sendScroll((double) ev.getAxisValue(MotionEvent.AXIS_VSCROLL), (double) ev.getAxisValue(MotionEvent.AXIS_HSCROLL));
|
||||||
return true;
|
return true;
|
||||||
case MotionEvent.ACTION_BUTTON_PRESS:
|
case MotionEvent.ACTION_BUTTON_PRESS:
|
||||||
|
|
||||||
return sendMouseButtonUnconverted(ev.getActionButton(),true);
|
return sendMouseButtonUnconverted(ev.getActionButton(),true);
|
||||||
case MotionEvent.ACTION_BUTTON_RELEASE:
|
case MotionEvent.ACTION_BUTTON_RELEASE:
|
||||||
return sendMouseButtonUnconverted(ev.getActionButton(),false);
|
return sendMouseButtonUnconverted(ev.getActionButton(),false);
|
||||||
@ -783,6 +785,7 @@ public class BaseMainActivity extends LoggableActivity {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
boolean isKeyboard(KeyEvent evt) {
|
boolean isKeyboard(KeyEvent evt) {
|
||||||
if((evt.getFlags() & KeyEvent.FLAG_SOFT_KEYBOARD) == KeyEvent.FLAG_SOFT_KEYBOARD) return true;
|
if((evt.getFlags() & KeyEvent.FLAG_SOFT_KEYBOARD) == KeyEvent.FLAG_SOFT_KEYBOARD) return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user