Update ControlDirection.java
This commit is contained in:
parent
e7c488a9cf
commit
ed6ff40abb
|
@ -655,7 +655,7 @@ public class ControlDirection extends RelativeLayout implements CustomView {
|
|||
xDist = left - buttonLeft;
|
||||
selfX = left - xDist;
|
||||
}
|
||||
if (Math.abs(left - buttonRight) < xDist) {
|
||||
if (left - buttonRight >= 0 && left - buttonRight < xDist) {
|
||||
xPref = true;
|
||||
prefX = buttonRight;
|
||||
xDist = left - buttonRight - dist;
|
||||
|
@ -667,7 +667,7 @@ public class ControlDirection extends RelativeLayout implements CustomView {
|
|||
xDist = right - buttonRight;
|
||||
selfX = right - xDist;
|
||||
}
|
||||
if (Math.abs(right - buttonLeft) < xDist) {
|
||||
if (buttonLeft - right >= 0 && buttonLeft - right < xDist) {
|
||||
xPref = true;
|
||||
prefX = buttonLeft;
|
||||
xDist = right - buttonLeft + dist;
|
||||
|
@ -679,7 +679,7 @@ public class ControlDirection extends RelativeLayout implements CustomView {
|
|||
yDist = up - buttonUp;
|
||||
selfY = up - yDist;
|
||||
}
|
||||
if (Math.abs(up - buttonDown) < yDist) {
|
||||
if (up - buttonDown >= 0 && up - buttonDown < yDist) {
|
||||
yPref = true;
|
||||
prefY = buttonDown;
|
||||
yDist = up - buttonDown - dist;
|
||||
|
@ -691,7 +691,7 @@ public class ControlDirection extends RelativeLayout implements CustomView {
|
|||
yDist = down - buttonDown;
|
||||
selfY = down - yDist;
|
||||
}
|
||||
if (Math.abs(down - buttonUp) < yDist) {
|
||||
if (buttonUp - down >= 0 && buttonUp - down < yDist) {
|
||||
yPref = true;
|
||||
prefY = buttonUp;
|
||||
yDist = down - buttonUp + dist;
|
||||
|
|
Loading…
Reference in New Issue