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;
|
xDist = left - buttonLeft;
|
||||||
selfX = left - xDist;
|
selfX = left - xDist;
|
||||||
}
|
}
|
||||||
if (Math.abs(left - buttonRight) < xDist) {
|
if (left - buttonRight >= 0 && left - buttonRight < xDist) {
|
||||||
xPref = true;
|
xPref = true;
|
||||||
prefX = buttonRight;
|
prefX = buttonRight;
|
||||||
xDist = left - buttonRight - dist;
|
xDist = left - buttonRight - dist;
|
||||||
|
@ -667,7 +667,7 @@ public class ControlDirection extends RelativeLayout implements CustomView {
|
||||||
xDist = right - buttonRight;
|
xDist = right - buttonRight;
|
||||||
selfX = right - xDist;
|
selfX = right - xDist;
|
||||||
}
|
}
|
||||||
if (Math.abs(right - buttonLeft) < xDist) {
|
if (buttonLeft - right >= 0 && buttonLeft - right < xDist) {
|
||||||
xPref = true;
|
xPref = true;
|
||||||
prefX = buttonLeft;
|
prefX = buttonLeft;
|
||||||
xDist = right - buttonLeft + dist;
|
xDist = right - buttonLeft + dist;
|
||||||
|
@ -679,7 +679,7 @@ public class ControlDirection extends RelativeLayout implements CustomView {
|
||||||
yDist = up - buttonUp;
|
yDist = up - buttonUp;
|
||||||
selfY = up - yDist;
|
selfY = up - yDist;
|
||||||
}
|
}
|
||||||
if (Math.abs(up - buttonDown) < yDist) {
|
if (up - buttonDown >= 0 && up - buttonDown < yDist) {
|
||||||
yPref = true;
|
yPref = true;
|
||||||
prefY = buttonDown;
|
prefY = buttonDown;
|
||||||
yDist = up - buttonDown - dist;
|
yDist = up - buttonDown - dist;
|
||||||
|
@ -691,7 +691,7 @@ public class ControlDirection extends RelativeLayout implements CustomView {
|
||||||
yDist = down - buttonDown;
|
yDist = down - buttonDown;
|
||||||
selfY = down - yDist;
|
selfY = down - yDist;
|
||||||
}
|
}
|
||||||
if (Math.abs(down - buttonUp) < yDist) {
|
if (buttonUp - down >= 0 && buttonUp - down < yDist) {
|
||||||
yPref = true;
|
yPref = true;
|
||||||
prefY = buttonUp;
|
prefY = buttonUp;
|
||||||
yDist = down - buttonUp + dist;
|
yDist = down - buttonUp + dist;
|
||||||
|
|
Loading…
Reference in New Issue