Merge pull request #758 from duchuule/hotfix1

fix bug where touch hitbox of analog stick is not full circle
This commit is contained in:
Cameron Gutman 2019-12-01 22:29:02 -06:00 committed by GitHub
commit a0a2b299d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -293,12 +293,12 @@ public class AnalogStick extends VirtualControllerElement {
movement_radius = getMovementRadius(relative_x, relative_y); movement_radius = getMovementRadius(relative_x, relative_y);
movement_angle = getAngle(relative_x, relative_y); movement_angle = getAngle(relative_x, relative_y);
// chop radius if out of outer circle and already pressed // pass touch event to parent if out of outer circle
if (movement_radius > (radius_complete - radius_analog_stick)) { if (movement_radius > radius_complete && !isPressed())
// not pressed already, so ignore event from outer circle
if (!isPressed()) {
return false; return false;
}
// chop radius if out of outer circle or near the edge
if (movement_radius > (radius_complete - radius_analog_stick)) {
movement_radius = radius_complete - radius_analog_stick; movement_radius = radius_complete - radius_analog_stick;
} }