Home / Topic / object swipe direction

object swipe direction

Home Kwiksher Forums Help me! object swipe direction

Viewing 2 posts - 1 through 2 (of 2 total)
  • miacobelli
    Participant
    #83932

    Hi everyone,
    is there a way to swipe on object only in one direction? I have to develop 2 swipe gesture, one for the left side and one for right side of the object.

    Tnxs a lot!

    Yamamoto
    Keymaster
    #83944

    Swipe direction is not supported now.

    It could be done with external code to override the swipe function generated by Kwik.
    If you create a swipe on object, you will find the codes like below in the lua file.

    composer.Shape_1Swipe = function (event )
    if event.phase == “ended” and event.direction ~= nil then
    act_834()
    end
    return true
    end
    layer.Shape_1:addEventListener( composer.Gesture.SWIPE_EVENT, composer.Shape_1Swipe )

    Copy the codes to a new lua file which you are going to use it as external code.
    event.direction is now nil but you can modify it equal to “right” or “left”
    Insert the external code after buttons and actions.
    ————–
    external code
    ————-
    layer.Shape_1:removeEventListener ( composer.Gesture.SWIPE_EVENT, composer.Shape_1Swipe );
    composer.Shape_1Swipe = function (event )
    if event.phase == “ended” and event.direction = “left” then
    act_834()
    end
    return true
    end
    layer.Shape_1:addEventListener( composer.Gesture.SWIPE_EVENT, composer.Shape_1Swipe )

Viewing 2 posts - 1 through 2 (of 2 total)

The forum ‘Help me!’ is closed to new topics and replies.