mirror of
https://github.com/2009scape/2009Scape-mobile.git
synced 2025-12-19 21:10:11 -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()));
|
||||
|
||||
//Getting scaled position from the event
|
||||
if(!CallbackBridge.isGrabbing()) {
|
||||
mouse_x = (int) (e.getX() * scaleFactor);
|
||||
mouse_y = (int) (e.getY() * scaleFactor);
|
||||
}
|
||||
|
||||
int hudKeyHandled = handleGuiBar((int)e.getX(), (int)e.getY());
|
||||
if (!CallbackBridge.isGrabbing() && gestureDetector.onTouchEvent(e) && hudKeyHandled == -1){
|
||||
int hudKeyHandled;
|
||||
if (!CallbackBridge.isGrabbing() && gestureDetector.onTouchEvent(e)){
|
||||
CallbackBridge.putMouseEventWithCoords(rightOverride ? (byte) 1 : (byte) 0, mouse_x, mouse_y);
|
||||
if (!rightOverride) CallbackBridge.mouseLeft = true;
|
||||
return true;
|
||||
|
|
@ -352,8 +353,8 @@ public class BaseMainActivity extends LoggableActivity {
|
|||
prevX = e.getX();
|
||||
prevY = e.getY();
|
||||
|
||||
//Compute the touchbar after
|
||||
// to avoid mouse jumps.
|
||||
|
||||
hudKeyHandled = handleGuiBar((int)e.getX(), (int) e.getY());
|
||||
isTouchInHotbar = hudKeyHandled != -1;
|
||||
if (isTouchInHotbar) {
|
||||
sendKeyPress(hudKeyHandled);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue