Gamua / Starling-Framework

The Cross Platform Game Engine
http://www.starling-framework.org
Other
2.82k stars 821 forks source link

TouchEvent multitouch three finger bug #1046

Closed subdan closed 5 years ago

subdan commented 5 years ago

Hello, Daniel. I've found a bug when using TouchEvent.

When I tap three fingers at the same time on three different display objects TouchPhase.ENDED doesn't fired. For two objects there isn't an issue.

var quad1:Quad = new Quad(50,50,0xFFFFFF);
addChild(quad1);

var quad2:Quad = new Quad(50,50,0xFFFFFF);
quad2.y = 60;
addChild(quad2);

var quad3:Quad = new Quad(50,50,0xFFFFFF);
quad3.y = 140;
addChild(quad3);

addEventListener(TouchEvent.TOUCH, touchHandler);

function touchHandler(event:TouchEvent):void
{
    var touch1:Touch = event.getTouch(quad1);
    var touch2:Touch = event.getTouch(quad2);
    var touch3:Touch = event.getTouch(quad3);

    if (touch1)
        if (touch1.phase == TouchPhase.BEGAN)
            quad1.color = 0xCCCCCC;
        else if (touch1.phase == TouchPhase.ENDED)
            quad1.color = 0xFFFFFF;

    if (touch2)
        if (touch2.phase == TouchPhase.BEGAN)
            quad2.color = 0xCCCCCC;
        else if (touch2.phase == TouchPhase.ENDED)
            quad2.color = 0xFFFFFF;

    if (touch3)
        if (touch3.phase == TouchPhase.BEGAN)
            quad3.color = 0xCCCCCC;
        else if (touch3.phase == TouchPhase.ENDED)
            quad3.color = 0xFFFFFF;
}

There are three Quad's on the screen. Tap on these quads with three fingers simultaneously. These three quads should be white when you release your fingers but it is not.

PrimaryFeather commented 5 years ago

Hi Daniil,

hm, this works fine when I try it! On which type of device did you test it? And did you enable Starling.multitouchEnabled before starting Starling?

(I tested on an iPhone.)

subdan commented 5 years ago

I test on Android tablet. Yes, I did.

PrimaryFeather commented 5 years ago

Just tried on an Android device, too - without issues. And to be honest, that touch handling code hasn't been changed for a long time, so it should be rather solid.

Please check the settings of your device and if other multitouch apps work correctly. This stackoverflow discussion might provide a starting point.

subdan commented 5 years ago

Ok, I will check again and get back to you within a day.

subdan commented 5 years ago

Thanks for the stackoverflow link. I disabled Acer's three-finger gesture to make screenshot and the issue is gone.

PrimaryFeather commented 5 years ago

I'm happy to hear that! :smile: