mirror of
https://github.com/2009scape/2009Scape-mobile.git
synced 2025-12-21 09:01:56 -07:00
Optimized how many times we use handle GUI bar function.
This commit is contained in:
parent
2d818e8786
commit
876ae5c285
1 changed files with 5 additions and 4 deletions
|
|
@ -330,13 +330,14 @@ public class BaseMainActivity extends LoggableActivity {
|
||||||
|
|
||||||
// System.out.println("Pre touch, isTouchInHotbar=" + Boolean.toString(isTouchInHotbar) + ", action=" + MotionEvent.actionToString(e.getActionMasked()));
|
// System.out.println("Pre touch, isTouchInHotbar=" + Boolean.toString(isTouchInHotbar) + ", action=" + MotionEvent.actionToString(e.getActionMasked()));
|
||||||
|
|
||||||
|
//Getting scaled position from the event
|
||||||
if(!CallbackBridge.isGrabbing()) {
|
if(!CallbackBridge.isGrabbing()) {
|
||||||
mouse_x = (int) (e.getX() * scaleFactor);
|
mouse_x = (int) (e.getX() * scaleFactor);
|
||||||
mouse_y = (int) (e.getY() * scaleFactor);
|
mouse_y = (int) (e.getY() * scaleFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
int hudKeyHandled = handleGuiBar((int)e.getX(), (int)e.getY());
|
int hudKeyHandled;
|
||||||
if (!CallbackBridge.isGrabbing() && gestureDetector.onTouchEvent(e) && hudKeyHandled == -1){
|
if (!CallbackBridge.isGrabbing() && gestureDetector.onTouchEvent(e)){
|
||||||
CallbackBridge.putMouseEventWithCoords(rightOverride ? (byte) 1 : (byte) 0, mouse_x, mouse_y);
|
CallbackBridge.putMouseEventWithCoords(rightOverride ? (byte) 1 : (byte) 0, mouse_x, mouse_y);
|
||||||
if (!rightOverride) CallbackBridge.mouseLeft = true;
|
if (!rightOverride) CallbackBridge.mouseLeft = true;
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -352,8 +353,8 @@ public class BaseMainActivity extends LoggableActivity {
|
||||||
prevX = e.getX();
|
prevX = e.getX();
|
||||||
prevY = e.getY();
|
prevY = e.getY();
|
||||||
|
|
||||||
//Compute the touchbar after
|
|
||||||
// to avoid mouse jumps.
|
hudKeyHandled = handleGuiBar((int)e.getX(), (int) e.getY());
|
||||||
isTouchInHotbar = hudKeyHandled != -1;
|
isTouchInHotbar = hudKeyHandled != -1;
|
||||||
if (isTouchInHotbar) {
|
if (isTouchInHotbar) {
|
||||||
sendKeyPress(hudKeyHandled);
|
sendKeyPress(hudKeyHandled);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue