Ignore OSC roll-over events if the button is already pressed

This commit is contained in:
lynxnb 2023-04-03 13:26:23 +02:00 committed by Billy Laws
parent 560fcd9442
commit 655ca8f89b
1 changed files with 5 additions and 1 deletions

View File

@ -151,7 +151,11 @@ class OnScreenControllerView @JvmOverloads constructor(context : Context, attrs
for (buttonPair in controls.buttonPairs) {
if (buttonPair.contains(button)) {
for (otherButton in buttonPair) {
if (otherButton != button && otherButton.config.enabled && otherButton.isTouched(event.getX(fingerId), event.getY(fingerId))) {
if (otherButton.partnerPointerId == -1 &&
otherButton != button &&
otherButton.config.enabled &&
otherButton.isTouched(event.getX(fingerId), event.getY(fingerId))
) {
otherButton.partnerPointerId = fingerId
if (otherButton.onFingerDown(x, y))
onButtonStateChangedListener?.invoke(otherButton.buttonId, ButtonState.Pressed)