Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GESTURE_BEGAN and GESTURE_ENDED not fired on iOS devices. #70

Open
SlavomirDurej opened this issue Apr 29, 2014 · 2 comments
Open

GESTURE_BEGAN and GESTURE_ENDED not fired on iOS devices. #70

SlavomirDurej opened this issue Apr 29, 2014 · 2 comments

Comments

@SlavomirDurej
Copy link

Got a code here (pretty much taken from the example code :

private function initGestures() : void
{
    transformGesture = new TransformGesture(photoSprite);
    transformGesture.addEventListener(org.gestouch.events.GestureEvent.GESTURE_BEGAN, onGesture);
    transformGesture.addEventListener(org.gestouch.events.GestureEvent.GESTURE_CHANGED, onGesture);
    transformGesture.addEventListener(org.gestouch.events.GestureEvent.GESTURE_ENDED, resumeScroll);
}


private function onGesture(event : org.gestouch.events.GestureEvent) : void
{
    const gesture : TransformGesture = event.target as TransformGesture;
    var matrix : Matrix = photoSprite.transform.matrix;

    trace("Event type "+event.type);
    trace("eventPhase "+event.eventPhase);

    if (event.type == GestureEvent.GESTURE_BEGAN)
    {
        toggleScroll(true);
    }

    // Panning
    matrix.translate(gesture.offsetX, gesture.offsetY);
    photoSprite.transform.matrix = matrix;

    if (gesture.scale != 1 || gesture.rotation != 0)
    {
        // Scale and rotation.
        var transformPoint : Point = matrix.transformPoint(photoSprite.globalToLocal(gesture.location));
        matrix.translate(-transformPoint.x, -transformPoint.y);
        matrix.rotate(gesture.rotation);
        matrix.scale(gesture.scale, gesture.scale);
        matrix.translate(transformPoint.x, transformPoint.y);

        photoSprite.transform.matrix = matrix;
    }
}


private function toggleScroll(pause : Boolean) : void
{
    if (pause)
    {
        scroll.verticalScrollingEnabled = false;
        scroll.pauseScrolling();
    }
    else 
    {
        scroll.verticalScrollingEnabled = true;
        scroll.resumeScrolling();
    }
}

private function resumeScroll(event : org.gestouch.events.GestureEvent) : void
{
    toggleScroll(false);
}

The Transform gesture works fine both on Android and iOS, which is great, but I need to capture both GESTURE_BEGAN and GESTURE_ENDED as there's another scroll functionality on the whole page. So I listen for the began and end events to stop the entire screen scrolling and only deal with transforming the image.

While this works fine on Android , on iOS devices (tested on iPhone4 and iPad3) this does not work. The problem is GESTURE_BEGAN and GESTURE_ENDED is not being fired on iOS devices.

Any ideas why or how to fix this ?

Many thanks..

@SlavomirDurej
Copy link
Author

I've now found out this is ONLY happening when packaging with the new AIR 4+ faster packer (and -useLegacyAOT no switch) When using original packaging method -target ipa-test or ipa-debug etc, this works ok.

@JanFW
Copy link

JanFW commented Jun 3, 2014

With the latest SDKs installed (AIR + Apache Flex) GESTURE_ENDED does actually never get fired at all. However, GESTURE_CANCELLED gets sometimes fired when ending the gesture. This seems to be a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants