[solved] drag fonction bug on mobile

  • Hi !
    On mobile, the layer don't take the touch position in real time , and stop !

    desktop it's works ... any idea ?

    <layer name="test" type="text" html="test-drag" edge="center" align="topleft" bg="true" bgcapture="false" capture="true" handcursor="true" selectable="true"
    height="20" width="100" vcenter="true" zorder="100" parent="blockFp"
    ondown="dragTest(get(name),true);"
    onup="dragTest(get(name),false);"

    />


    <action name="dragTest" scope="local" args="layerhp,boolean">
    if(boolean,
    screentolayer(blockFp,mouse.stagex,mouse.stagey,lx,ly);
    set(layer[get(layerhp)].x,get(lx));
    set(layer[get(layerhp)].y,get(ly));

    delayedcall(testFollow,0.01,
    dragTest(get(layerhp),true);
    );
    ,
    stopdelayedcall(testFollow);
    );
    </action>


    same issue with asyncloop:

    <action name="dragTest" scope="local" args="layerhp">
    showlog();
    asyncloop(global.dragtestlayer,
    screentolayer(blockFp,mouse.stagex,mouse.stagey,lx,ly);
    set(layer[get(layerhp)].x,get(lx));
    set(layer[get(layerhp)].y,get(ly));
    );
    </action>

    on mobile it return the x/y pos of blockFp and stop

    layer blockFp is parent="STAGE" and is outside area

    Edited 5 times, last by MrTie (April 3, 2018 at 11:22 AM).

  • added in js


    and do this on my drag function :


    because the mouse position only work inside area and not outside area + (layer parent = stage) on mobile :)

    Edited once, last by MrTie (April 3, 2018 at 11:48 AM).

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!